﻿<%
Dim Html
Set Html = New Public_Cls
Class Public_Cls
	'================================================
	'函数名：LoadChannelList
	'作  用：装载模型列表
	'参  数：ClassID   ----栏目ID
	'        ChannelID   ----模型ID
	'        SpecialID  ----专题ID
	'        TopNum   ----显示文章列表数
	'        strlen   ----显示标题长度
	'        ShowClass   ----是否显示栏目
	'        ShowPic   ----是否显示图文标题
	'        IsPic   ----是否显示图前标
	'        ShowDate   ----是否显示日期
	'        DateMode   ----显示日期模式
	'        newindow   ----新窗口打开
	'        HtmlStr    ----列表代码
	'================================================
	Public Function LoadChannelList(ByVal ChannelID, ByVal ClassID, ByVal TopNum, ByVal ColNum, ByVal strLen, ByVal ShowClass, ByVal ShowPic, ByVal IsPic, ByVal ShowDate, ByVal DateMode, ByVal newindow, ByVal styles, ByVal OrderType, ByVal Marquee, ByVal Direction2, ByVal Step, ByVal Width, ByVal Height, ByVal Timer2, ByVal DelayTime, ByVal WaitTime, ByVal ScrollStep)
		
		Dim Rs, Sql, i, strContent, foundstr
		Dim sDot,sTitle, sTopic, ChildStr, ListStyle, BestCode, BestString
		Dim ArticleTopic, ClassName, HtmlFileUrl, WriteTime, LinkTarget, HtmlFileName

		ChannelID = ChkNumeric(ChannelID)
		ClassID = ChkNumeric(ClassID)
		SpecialID = ChkNumeric(SpecialID)
		strLen = ChkNumeric(strLen)
		If Code_CLng(TopNum) = 0 Then TopNum = 10
		
		Call GetChannel(ChannelID)
		
		strContent =  ""
		
		If CLng(ClassID) <> 0 Then
			Sql = "Select ClassChildStr From [Class] Where ChannelID=" & ChannelID & " And ClassID=" & ClassID
			Call Exec(Rs,Sql,2)
			If Rs.BOF And Rs.EOF Then
				Set Rs = Nothing
				LoadChannelList = "暂无栏目！"
				Exit Function
			Else
				ChildStr = Rs("ClassChildStr")
			End If
			Set Rs = Nothing
		Else
			ChildStr = "0"
		End If
		If CLng(ClassID) <> 0 Then
			foundstr="And A.ClassID in (" & ChildStr & ") Order By A.OrderID " & OrderType & ",A.ID " & OrderType
		Else
			foundstr="Order By A.OrderID " & OrderType & ",A.ID " & OrderType
		End If
		If CLng(SpecialID) <> 0 Then
			foundstr = "And A.SpecialID =" & CLng(SpecialID) & " " & foundstr
		End If
		Sql = " A.ID,A.ClassID,A.TColor,A.Title,A.IncludeInfo,A.IsPic,A.Pic,A.Hits,A.Tim,A.HtmlFileDate,"
		Sql = "Select Top " & CInt(TopNum) & Sql & " C.ClassName,C.HtmlFileDir From [" & ChannelDataName & "] A INNER JOIn [Class] C ON A.ClassID=C.ClassID Where A.Hidden=" & WK_True & " And A.IsDelete=" & WK_False & " And A.ChannelID=" & ChannelID & " " & foundstr & ""
		Call Exec(Rs,Sql,2)
		i = 0
		If Rs.BOF And Rs.EOF Then
			strContent = "该栏目还没有添加任何内容！"
		Else
		If Direction2<>"4" Then
			strContent = "<div id='" & Marquee & "' style='width:" & Width & "px;height:" & Height & "px;overflow:hidden;'>"
		End If
			strContent = strContent & "<table width=""100%"" border=""0"" align=""center"" cellpadding=""2"" cellspacing=""0"">" & vbCrLf
			Do While Not Rs.EOF
				strContent = strContent & "<tr>" & vbCrLf
				For i = 1 To CInt(ColNum)
					If Not Rs.EOF Then
						strContent = strContent & "<td>"
						If (i Mod 2) = 0 Then
							ListStyle = Trim(styles) & 1
						Else
							ListStyle = Trim(styles) & 2
						End If
						
						'前标
						sTopic = GetIncInfo(Rs("IncludeInfo"))
						If strLen<>0 Then
							sTitle = Cuted(Rs("Title"), strLen)
						Else
							sTitle = Rs("Title")
						End If
						sTitle = GetTcolor(sTitle,Rs("Tcolor"),False)
						If Rs("IsPic")=True And CInt(IsPic) = 1 Then sTitle = "<span style='color:red;'>[图]</span>" & sTitle
						
						If ChannelIsCreateHtml = True Then
							HtmlFileName = ReadFileName(Rs("HtmlFileDate"), Rs("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, "")
							HtmlFileUrl = InstallDir & ChannelDir & "/" & Rs("HtmlFileDir") & ShowDatePath(Rs("HtmlFileDate"), ChannelHtmlPath) & HtmlFileName
							ClassName = "[<a href='" & InstallDir & ChannelDir & "/" & Rs("HtmlFileDir") & "Index" & ChannelHtmlExtName & "'>" & Rs("ClassName") & "</a>]"
						Else
							HtmlFileUrl = InstallDir & ChannelDir & "/View.asp?id=" & Rs("ID")
							ClassName = "[<a href='" & InstallDir & ChannelDir & "/List.asp?ClassID=" & Rs("ClassID") & "'>" & Rs("ClassName") & "</a>]"
						End If
						
						If CInt(ShowClass) = 0 Then ClassName = ""
						If CInt(ShowPic) = 0 Then sTopic = ""
						If CInt(ShowDate) <> 0 Then
							WriteTime = ShowDateTime(Rs("Tim"), CInt(DateMode))
						Else
							WriteTime = ""
						End If
						If CInt(newindow) <> 0 Then
							LinkTarget = " target=""_blank"""
						Else
							LinkTarget = ""
						End If
						If ChannelIsCreateHtml = True Then
							ArticleTopic = "<a href='" & HtmlFileUrl & "'" & LinkTarget & " title='" & ChannelTit & "标题：" & Rs("Title") & "&#13;&#10;发布时间：" & Rs("Tim") & "' class='{$ListStyle}'>" & sTitle & "</a>"
						Else
							ArticleTopic = "<a href='" & HtmlFileUrl & "'" & LinkTarget & " title='" & ChannelTit & "标题：" & Rs("Title") & "&#13;&#10;发布时间：" & Rs("Tim") & "&#13;&#10;阅览次数：" & Rs("Hits") & "' class='{$ListStyle}'>" & sTitle & "</a>"
						End If
						strContent = strContent & "<table width=""100%"" border=""0"" align=""center"" cellpadding=""2"" cellspacing=""0""><tr>" & vbCrLf & "<td class='{$ListStyle}'>{$ClassName}&nbsp;{$BriefTopic}&nbsp;{$ArticleTopic}</td><td  align=right class='{$ListStyle}'>{$WriteTime}</td>" & vbCrLf & "</tr></table>"
						strContent = Replace(strContent, "{$ArticleTopic}", ArticleTopic)
						strContent = Replace(strContent, "{$ArticleID}", Rs("ID"))
						strContent = Replace(strContent, "{$ArticleTitle}", sTitle)
						strContent = Replace(strContent, "{$Title}", Rs("Title"))
						strContent = Replace(strContent, "{$Date}", Rs("Tim"))
						strContent = Replace(strContent, "{$BriefTopic}", sTopic)
						strContent = Replace(strContent, "{$HtmlFileUrl}", HtmlFileUrl)
						strContent = Replace(strContent, "{$ClassName}", ClassName)
						strContent = Replace(strContent, "{$Target}", LinkTarget)
						strContent = Replace(strContent, "{$WriteTime}", WriteTime)
						strContent = Replace(strContent, "{$AticleHits}", Rs("Hits"))
						strContent = Replace(strContent, "{$ListStyle}", ListStyle)
						strContent = Replace(strContent, "{$BestCode}", BestCode)
						strContent = Replace(strContent, "{$BestString}", BestString)
						Rs.MoveNext
						strContent = strContent & "</td>" & vbCrLf
					End If
				Next
				strContent = strContent & "</tr>" & vbCrLf
			Loop
			strContent = strContent & "</table>"
			If Direction2<>"4" Then
			strContent = strContent & "</div><script type='text/javascript'>new Marquee('" & Marquee & "'," & Direction2 & "," & Step & "," & Width & "," & Height & "," & Timer2 & "," & DelayTime & "," & WaitTime & "," & ScrollStep & ")</script>" & vbCrLf
			End If
		End If
		Rs.Close: Set Rs = Nothing
		LoadChannelList = strContent
	End Function
	
	
	'================================================
	'函数名：ReadChannelList
	'作  用：读取模型列表
	'参  数：strValue ----原字符串
	'================================================
	Public Function ReadChannelList(ByVal strValue)
		Dim strTemp
		strTemp = strValue
		regEx.Pattern = "\{\$ReadChannelList\((.*?)\)\}"
		Set Matches = regEx.Execute(strTemp)
		For Each Match In Matches
			strTemp = Replace(strTemp, Match.Value, GetListFromLabel(Match.SubMatches(0)))
		Next
		ReadChannelList = strTemp
	End Function
	
	Public Function GetListFromLabel(ByVal strSource)
		Dim ArrayList, tChannelID
		If strSource = "" Then
			GetListFromLabel = ""
			Exit Function
		End If
		strSource = Replace(strSource,Chr(34),"")
		strSource = FillInArrStr(strSource,"30,0,0,52", 22)
		ArrayList = Split(strSource, ",")
		If UBound(ArrayList) + 1 < 22 Then
			GetListFromLabel = "函数式标签：{$ReadChannelList(参数列表)}的参数个数不对。请检查模板中的此标签。"
			Exit Function
		End If
		Select Case Trim(ArrayList(0))
		Case "ChannelID"
			tChannelID = ChannelID
		Case Else
			tChannelID = ArrayList(0)
		End Select
		GetListFromLabel = LoadChannelList(tChannelID, ArrayList(1), ArrayList(2), ArrayList(3), ArrayList(4), ArrayList(5), ArrayList(6), ArrayList(7), ArrayList(8), ArrayList(9), ArrayList(10), ArrayList(11), ArrayList(12), ArrayList(13), ArrayList(14), ArrayList(15), ArrayList(16), ArrayList(17), ArrayList(18), ArrayList(19), ArrayList(20), ArrayList(21))
	End Function
	
	'================================================
	'函数名：LoadChannelPic
	'作  用：装载模型图片列表
	'参  数：ClassID   ----栏目ID
	'        ChannelID   ----模型ID
	'        SpecialID  ----专题ID
	'        TopNum   ----显示文章列表数
	'        ColNum  ----每行显示数目
	'        strlen   ----显示标题长度
    '        width
	'        height
	'        newindow   ----新窗口打开
	'        showtopic
	'================================================
	Public Function LoadChannelPic(ByVal ChannelID, ByVal ClassID, ByVal TopNum, ByVal ColNum, ByVal strLen, ByVal newindow, ByVal Width, ByVal Height, ByVal showtopic, ByVal OrderType, ByVal Marquee, ByVal Direction2, ByVal Step, ByVal MarqueeWidth, ByVal MarqueeHeight, ByVal Timer2, ByVal DelayTime, ByVal WaitTime, ByVal ScrollStep)
		Dim Rs, Sql, i, strContent, foundstr, RsCount, UnCount
		Dim sTitle, ChildStr, ImageUrl, HtmlFileName
		Dim HtmlFileUrl, WriteTime, LinkTarget
		ChannelID = ChkNumeric(ChannelID)
		ClassID = ChkNumeric(ClassID)
		SpecialID = ChkNumeric(SpecialID)
		strLen = ChkNumeric(strLen)
		If Code_CLng(TopNum) = 0 Then TopNum = 10
		
		Call GetChannel(ChannelID)
		
		If CLng(ClassID) <> 0 Then
			Sql = "Select ClassChildStr From [Class] Where ChannelID=" & ChannelID & " And ClassID=" & ClassID
			Call Exec(Rs,Sql,2)
			If Rs.BOF And Rs.EOF Then
				Set Rs = Nothing
				LoadChannelPic = "暂无栏目！"
				Exit Function
			Else
				ChildStr = Rs("ClassChildStr")
			End If
			Set Rs = Nothing
		Else
			ChildStr = "0"
		End If
		If CLng(ClassID) <> 0 Then
			foundstr="And A.ClassID in (" & ChildStr & ") And A.IsPic=" & WK_True & " Order By A.OrderID " & OrderType & ",A.ID " & OrderType
		Else
			foundstr="And A.IsPic=" & WK_True & " Order By A.OrderID " & OrderType & ",A.ID " & OrderType
		End If
		If CLng(SpecialID) <> 0 Then
			foundstr = "And A.SpecialID =" & CLng(SpecialID) & " " & foundstr
		End If
		Sql = " A.ID,A.ClassID,A.TColor,A.Title,A.IncludeInfo,A.IsPic,A.Pic,A.Hits,A.Tim,A.HtmlFileDate,"
		Sql = "Select Top " & CInt(TopNum) & Sql & " C.ClassName,C.HtmlFileDir From [" & ChannelDataName & "] A INNER JOIn [Class] C ON A.ClassID=C.ClassID Where A.Hidden=" & WK_True & " And A.IsDelete=" & WK_False & " And A.ChannelID=" & ChannelID & " " & foundstr & ""
		Call Exec(Rs,Sql,2)
		i = 0
		If Rs.BOF And Rs.EOF Then
			strContent = "<img src='" & InstallDir & "Images/no_pic.png' width='" & Width & "' height='" & Height & "' border='0' />"
		Else
		If Direction2<>"4" Then
			If CLng(ClassID) <> 0 Then
				Call Exec(RsCount,"Select Count(ID) From [" & ChannelDataName & "] Where IsPic=" & WK_True & " And Hidden=" & WK_True & " And IsDelete=" & WK_False & " And ChannelID=" & ChannelID & " And ClassID in (" & ChildStr & ")",2)
			Else
				Call Exec(RsCount,"Select Count(ID) From [" & ChannelDataName & "] Where IsPic=" & WK_True & " And Hidden=" & WK_True & " And IsDelete=" & WK_False & " And ChannelID=" & ChannelID,2)
			End If
			If Not (RsCount.EOF And RsCount.bof) Then
				UnCount = RsCount(0)
			Else
				UnCount = 0
			End If
			If UnCount>CInt(TopNum) Then UnCount=TopNum
			strContent = "<div id='" & Marquee & "' style='width:" & MarqueeWidth & "px;height:" & MarqueeHeight & "px;overflow:hidden;'>"
			strContent = strContent & "<table width=""" & (Width+10)*UnCount & """ border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"">" & vbCrLf
		Else
			strContent = strContent & "<table width=""100%"" border=""0"" align=""center"" cellpadding=""2"" cellspacing=""0"">" & vbCrLf
		End If
			Do While Not Rs.EOF
				strContent = strContent & "<tr>" & vbCrLf
				For i = 1 To CInt(ColNum)
					If Not Rs.EOF Then
						strContent = strContent & "<td"
						If Direction2<>"4" Then strContent = strContent & " width=""" & Width+10 & """"
						strContent = strContent & " align=""center"" class=""imagelist"">"
						
						If strLen<>0 Then
							sTitle = Cuted(Rs("Title"), strLen)
						Else
							sTitle = Rs("Title")
						End If
						sTitle = GetTcolor(sTitle,Rs("Tcolor"),False)
						
						If Rs("Pic")="" Then
							ImageUrl = InstallDir & "Images/no_pic.png"
						Else
							ImageUrl = Rs("Pic")
							ImageUrl = Replace(ImageUrl, "{$download_dir}", InstallDir&UploadSetting(1))
						End If
						ImageUrl = "<img src='" & ImageUrl & "' width='" & Width & "' height='" & Height & "' border='0' />"
							   
						If ChannelIsCreateHtml = True Then
							HtmlFileName = ReadFileName(Rs("HtmlFileDate"), Rs("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, "")
							HtmlFileUrl = InstallDir & ChannelDir & "/" & Rs("HtmlFileDir") & ShowDatePath(Rs("HtmlFileDate"), ChannelHtmlPath) & HtmlFileName
						Else
							HtmlFileUrl = InstallDir & ChannelDir & "/View.asp?id=" & Rs("ID")
						End If
		 
						If CInt(newindow) <> 0 Then
							LinkTarget = " target=""_blank"""
						Else
							LinkTarget = ""
						End If
						strContent = strContent & "<div>{$ArticlePicture}</div><div style='line-height: 22px;'>{$ArticleTopic}</div>"
						If ChannelIsCreateHtml = True Then
							strContent = Replace(strContent, "{$ArticlePicture}", "<a href='" & HtmlFileUrl & "' title='" & ChannelTit & "标题：" & Rs("Title") & "&#13;&#10;发布时间：" & Rs("Tim") & "'" & LinkTarget & ">" & ImageUrl & "</a>")
						Else
							strContent = Replace(strContent, "{$ArticlePicture}", "<a href='" & HtmlFileUrl & "' title='" & ChannelTit & "标题：" & Rs("Title") & "&#13;&#10;发布时间：" & Rs("Tim") & "&#13;&#10;阅览次数：" & Rs("Hits") & "'" & LinkTarget & ">" & ImageUrl & "</a>")
						End If
						If CInt(showtopic) = 1 Then
							If ChannelIsCreateHtml = True Then
								strContent = Replace(strContent, "{$ArticleTopic}", "<a href='" & HtmlFileUrl & "' title='" & ChannelTit & "标题：" & Rs("Title") & "&#13;&#10;发布时间：" & Rs("Tim") & "'" & LinkTarget & ">" & sTitle & "</a>")
							Else
								strContent = Replace(strContent, "{$ArticleTopic}", "<a href='" & HtmlFileUrl & "' title='" & ChannelTit & "标题：" & Rs("Title") & "&#13;&#10;发布时间：" & Rs("Tim") & "&#13;&#10;阅览次数：" & Rs("Hits") & "'" & LinkTarget & ">" & sTitle & "</a>")
							End If
						Else
							strContent = Replace(strContent, "{$ArticleTopic}", vbNullString)
						End If
						Rs.MoveNext
						strContent = strContent & "</td>" & vbCrLf
					End If
				Next
				strContent = strContent & "</tr>" & vbCrLf
			Loop
			strContent = strContent & "</table>"
			If Direction2<>"4" Then
			strContent = strContent & "</div><script type='text/javascript'>new Marquee('" & Marquee & "'," & Direction2 & "," & Step & "," & MarqueeWidth & "," & MarqueeHeight & "," & Timer2 & "," & DelayTime & "," & WaitTime & "," & ScrollStep & ")</script>" & vbCrLf
			End If
		End If
		Rs.Close: Set Rs = Nothing
		LoadChannelPic = strContent				
	End Function
	
	'================================================
	'函数名：ReadChannelPic
	'作  用：读取模型图片列表
	'参  数：strValue ----原字符串
	'================================================
	Public Function ReadChannelPic(ByVal strValue)
		Dim strTemp
		strTemp = strValue
		regEx.Pattern = "\{\$ReadChannelPic\((.*?)\)\}"
		Set Matches = regEx.Execute(strTemp)
		For Each Match In Matches
			strTemp = Replace(strTemp, Match.Value, GetPicFromLabel(Match.SubMatches(0)))
		Next
		ReadChannelPic = strTemp
	End Function
	
	Function GetPicFromLabel(ByVal strSource)
        Dim ArrayList, tChannelID
        If strSource = "" Then
            GetPicFromLabel = ""
            Exit Function
        End If
		strSource = Replace(strSource,Chr(34),"")
		strSource = FillInArrStr(strSource, "0", 19)
		ArrayList = Split(strSource, ",")
        If UBound(ArrayList) + 1 < 19 Then
            GetPicFromLabel = "函数式标签：{$ReadChannelPic(参数列表)}的参数个数不对。请检查模板中的此标签。"
            Exit Function
        End If
        Select Case Trim(ArrayList(0))
        Case "ChannelID"
            tChannelID = ChannelID
        Case Else
            tChannelID = ArrayList(0)
        End Select
        GetPicFromLabel = LoadChannelPic(tChannelID, ArrayList(1), ArrayList(2), ArrayList(3), ArrayList(4), ArrayList(5), ArrayList(6), ArrayList(7), ArrayList(8), ArrayList(9), ArrayList(10), ArrayList(11), ArrayList(12), ArrayList(13), ArrayList(14), ArrayList(15), ArrayList(16), ArrayList(17), ArrayList(18))
    End Function
	
	'================================================
	'函数名：LoadChannelFlash
	'作  用：装载模型Flash列表
	'参  数：ClassID   ----栏目ID
	'        ChannelID   ----模型ID
	'        SpecialID  ----专题ID
	'        TopNum   ----显示文章列表数
	'        strlen   ----显示标题长度
	'        Width   ----图片宽度
	'        Heitht   ----图片高度
	'        TitleBgAlpha   ----图片名称文字背景颜色透明度：0-100值，0表示全部透明   默认值:70
	'        TitleBgPosition   ----图片名称文字位置，0表示文字在顶端，1表示文字在底部，2表示文字在顶端浮动   默认值:30
	'        Tween   ----图片过渡效果：0，表示亮度过渡，1表示透明度过渡，2表示模糊过渡，3表示运动模糊过渡   默认值:2
	'        AutoPlayTime   ----图片自动播放时间：单位是秒  默认值:120
	'        WinOpen   ----图片打开窗口：_blank表示新窗口打开。_self表示在当前窗口打开  默认值:_blank
	'        TitleTextColor   ----图片名称文字颜色  默认值:FFFFFF
	'        TitleBgColor   ----图片名称文字背景颜色  默认值:000000
	'        BtnDefaultColor   ----图片按键默认的颜色  默认值:000000
	'        BtnOverColor   ----按键当前的颜色  默认值:000033
	'================================================
	Public Function LoadChannelFlash(ByVal ChannelID, ByVal ClassID, ByVal TopNum, ByVal strLen, ByVal Width, ByVal Heitht, ByVal TitleBgAlpha, ByVal TitleBgPosition, ByVal Tween, ByVal AutoPlayTime, ByVal WinOpen, ByVal TitleTextColor, ByVal TitleBgColor, ByVal BtnDefaultColor, ByVal BtnOverColor, ByVal OrderType)

		Dim Rs, Sql, i, strContent, foundstr
		Dim sDot, sTitle, sTopic, ChildStr ,TopicType
		Dim ClassName, HtmlFileUrl, Pic, LinkTarget, HtmlFileName, files, texts, links

		ChannelID = ChkNumeric(ChannelID)
		ClassID = ChkNumeric(ClassID)
		SpecialID = ChkNumeric(SpecialID)
		strLen = ChkNumeric(strLen)
		If Code_CLng(TopNum) = 0 Then TopNum = 10

		Call GetChannel(ChannelID)

		If CLng(ClassID) <> 0 Then
			Sql = "Select ClassChildStr From [Class] Where ChannelID=" & ChannelID & " And ClassID=" & ClassID
			Call Exec(Rs,Sql,2)
			If Rs.BOF And Rs.EOF Then
				Set Rs = Nothing
				LoadChannelFlash = "暂无栏目！"
				Exit Function
			Else
				ChildStr = Rs("ClassChildStr")
			End If
			Set Rs = Nothing
		Else
			ChildStr = "0"
		End If
		
		If CInt(WinOpen) <> 0 Then
			LinkTarget = "_blank"
		Else
			LinkTarget = "_self"
		End If

		If CLng(ClassID) <> 0 Then
			foundstr="And A.ClassID in (" & ChildStr & ") Order By A.OrderID " & OrderType & ",A.ID " & OrderType
		Else
			foundstr="Order By A.OrderID " & OrderType & ",A.ID " & OrderType
		End If
		If CLng(SpecialID) <> 0 Then
			foundstr = "And A.SpecialID =" & CLng(SpecialID) & " " & foundstr
		End If
		Sql = " A.ID,A.ClassID,A.TColor,A.Title,A.IncludeInfo,A.IsPic,A.Pic,A.Hits,A.Tim,A.HtmlFileDate,"
		Sql = "Select Top " & CInt(TopNum) & Sql & " C.ClassName,C.HtmlFileDir From [" & ChannelDataName & "] A INNER JOIn [Class] C ON A.ClassID=C.ClassID Where A.Hidden=" & WK_True & " And A.IsDelete=" & WK_False & " And A.IsPic=" & WK_True & " And A.ChannelID=" & ChannelID & " " & foundstr & ""
		Call Exec(Rs,Sql,2)
		i = 0
		If Rs.BOF And Rs.EOF Then
			strContent = "<img src='" & InstallDir & "Images/no_pic.png' width='" & Width & "' height='" & Heitht & "' border='0' />"
		Else
			Do While Not Rs.EOF
				If strLen<>0 Then
					sTitle = Cuted(Rs("Title"), strLen)
				Else
					sTitle = Rs("Title")
				End If
				Pic=Code_Html(Rs("Pic"),1,0)
				If CInt(ChannelIsCreateHtml) = True Then
					HtmlFileName = ReadFileName(Rs("HtmlFileDate"), Rs("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, "")
					HtmlFileUrl = InstallDir & ChannelDir & "/" & Rs("HtmlFileDir") & ShowDatePath(Rs("HtmlFileDate"), ChannelHtmlPath) & HtmlFileName
				Else
					HtmlFileUrl = InstallDir & ChannelDir & "/View.asp?id=" & Rs("ID")
				End If

				files= files & "|" & Pic
				links= links & "|" & HtmlFileUrl
				texts= texts & "|" & sTitle
			Rs.movenext
			loop
			Rs.close
			If left(files,1)="|" Then files=right(files,len(files)-1)
			If left(links,1)="|" Then links=right(links,len(links)-1)
			If left(texts,1)="|" Then texts=right(texts,len(texts)-1)

			StrContent = vbcrlf&"<script type=""text/javascript"">"&_
			vbcrlf&"var swf_width='" & Width & "'"&_
			vbcrlf&"var swf_height='" & Heitht & "'"&_
			vbcrlf&"var files='" & files & "'"&_
			vbcrlf&"var links='" & links & "'"&_
			vbcrlf&"var texts='" & texts & "'"&_
			vbcrlf&"var TitleBgAlpha='" & TitleBgAlpha & "'"&_
			vbcrlf&"var TitleBgPosition='" & TitleBgPosition & "'"&_
			vbcrlf&"var Tween='" & Tween & "'"&_
			vbcrlf&"var AutoPlayTime='" & AutoPlayTime & "'"&_
			vbcrlf&"var WinOpen='" & LinkTarget & "'"&_
			vbcrlf&"var TitleTextColor='0x" & TitleTextColor & "'"&_
			vbcrlf&"var TitleBgColor='0x" & TitleBgColor & "'"&_
			vbcrlf&"var BtnDefaultColor='0x" & BtnDefaultColor & "'"&_
			vbcrlf&"var BtnOverColor='0x" & BtnOverColor & "'"&_
			vbcrlf&"document.write('<object classid=""clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"" codebase=""http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"" width=""'+ swf_width +'"" height=""'+ swf_height +'"">');" &_
			vbcrlf&"document.write('<param name=""movie"" value=""" & InstallDir & "images/focus.swf""><param name=""quality"" value=""high"">');" &_
			vbcrlf&"document.write('<param name=""menu"" value=""false""><param name=wmode value=""opaque"">');" &_
			vbcrlf&"document.write('<param name=""FlashVars"" value=""bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'&TitleBgAlpha='+ TitleBgAlpha +'&TitleBgPosition='+ TitleBgPosition +'&Tween='+ Tween +'&AutoPlayTime='+ AutoPlayTime +'&WinOpen='+ WinOpen +'&TitleTextColor='+ TitleTextColor +'&TitleBgColor='+ TitleBgColor +'&BtnDefaultColor='+ BtnDefaultColor +'&BtnOverColor='+ BtnOverColor +'"">');" &_
			vbcrlf&"document.write('<embed src=""" & InstallDir & "images/focus.swf"" wmode=""opaque"" FlashVars=""bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'&TitleBgAlpha='+ TitleBgAlpha +'&TitleBgPosition='+ TitleBgPosition +'&Tween='+ Tween +'&AutoPlayTime='+ AutoPlayTime +'&WinOpen='+ WinOpen +'&TitleTextColor='+ TitleTextColor +'&TitleBgColor='+ TitleBgColor +'&BtnDefaultColor='+ BtnDefaultColor +'&BtnOverColor='+ BtnOverColor +'"" menu=""false"" quality=""high"" width=""'+ swf_width +'"" height=""'+ swf_height +'"" type=""application/x-shockwave-flash"" pluginspage=""http://www.macromedia.com/go/getflashplayer"" />');" &_
			vbcrlf&"document.write('</object>');" &_
			vbcrlf&"</script>"
		End If
		LoadChannelFlash = StrContent 
	End Function

	'================================================
	'函数名：ReadChannelFlash
	'作  用：读取模型Flash列表
	'参  数：strValue ----原字符串
	'================================================
	Public Function ReadChannelFlash(ByVal strValue)
		Dim strTemp
		strTemp = strValue
		regEx.Pattern = "\{\$ReadChannelFlash\((.*?)\)\}"
		Set Matches = regEx.Execute(strTemp)
		For Each Match In Matches
			strTemp = Replace(strTemp, Match.Value, GetFlashFromLabel(Match.SubMatches(0)))
		Next
		ReadChannelFlash = strTemp
	End Function
	
	Function GetFlashFromLabel(ByVal strSource)
        Dim ArrayList, tChannelID
        If strSource = "" Then
            GetFlashFromLabel = ""
            Exit Function
        End If
        strSource = Replace(strSource,Chr(34),"")
		strSource = FillInArrStr(strSource, "0", 16)
		ArrayList = Split(strSource, ",")
        If UBound(ArrayList) + 1 < 16 Then
            GetFlashFromLabel = "函数式标签：{$ReadChannelFlash(参数列表)}的参数个数不对。请检查模板中的此标签。"
            Exit Function
        End If
        Select Case Trim(ArrayList(0))
        Case "ChannelID"
            tChannelID = ChannelID
        Case Else
            tChannelID = ArrayList(0)
        End Select
        GetFlashFromLabel = LoadChannelFlash(tChannelID, ArrayList(1), ArrayList(2), ArrayList(3), ArrayList(4), ArrayList(5), ArrayList(6), ArrayList(7), ArrayList(8), ArrayList(9), ArrayList(10), ArrayList(11), ArrayList(12), ArrayList(13), ArrayList(14), ArrayList(15))
    End Function
	
		'================================================
	'函数名：LoadChannelFlashqq
	'作  用：装载模型Flash列表
	'参  数：ClassID   ----栏目ID
	'        ChannelID   ----模型ID
	'        SpecialID  ----专题ID
	'        TopNum   ----显示文章列表数
	'        strlen   ----显示标题长度
	'        Width   ----图片宽度
	'        Heitht   ----图片高度
	'        Times   ----间隔时间  默认值:4000
	'        Sizes   ----文本链接的文字大小   默认值:12px
	'        IsBold   ----文本链接的文字是否加粗  默认值:yes
	'        TxtColor   ----文本链接的颜色  默认值:FF7E00
	'        TxtLeft   ----文本链接左间距  默认值:19
	'        UmColor   ----数字按钮未选中时文本颜色  默认值:FFFFFF
	'        NubTouMing   ----数字按钮未选中时透明度  默认值:40
	'        HoverTouMing   ----数字按钮选中时透明度  默认值:100
	'        BtnBg   ----数字按钮未选中时背景颜色  默认值:FF7E00
	'        BgNub   ----数字按钮选中时背景色  默认值:FFFFFF
	'        HoverColor   ----数字按钮选中时文本色  默认值:FF0000
	'        Rname   ----右键菜单显示文字  默认值:开心网络
	'        Rlink   ----右键菜单链接  默认值:http://www.kaixin100.cn
	'================================================
	Public Function LoadChannelFlashqq(ByVal ChannelID, ByVal ClassID, ByVal TopNum, ByVal strLen, ByVal Width, ByVal Heitht, ByVal Times, ByVal Sizes, ByVal IsBold, ByVal TxtColor, ByVal TxtLeft, ByVal UmColor, ByVal NubTouMing, ByVal HoverTouMing, ByVal BtnBg, ByVal BgNub, ByVal HoverColor, ByVal Rname, ByVal Rlink, ByVal OrderType)

		Dim Rs, Sql, i, strContent, foundstr
		Dim sDot, sTitle, sTopic, ChildStr ,TopicType
		Dim ClassName, HtmlFileUrl, Pic, HtmlFileName, files, texts, links

		ChannelID = ChkNumeric(ChannelID)
		ClassID = ChkNumeric(ClassID)
		SpecialID = ChkNumeric(SpecialID)
		strLen = ChkNumeric(strLen)
		If Code_CLng(TopNum) = 0 Then TopNum = 10

		Call GetChannel(ChannelID)

		If CLng(ClassID) <> 0 Then
			Sql = "Select ClassChildStr From [Class] Where ChannelID=" & ChannelID & " And ClassID=" & ClassID
			Call Exec(Rs,Sql,2)
			If Rs.BOF And Rs.EOF Then
				Set Rs = Nothing
				LoadChannelFlashqq = "暂无栏目！"
				Exit Function
			Else
				ChildStr = Rs("ClassChildStr")
			End If
			Set Rs = Nothing
		Else
			ChildStr = "0"
		End If

		If CLng(ClassID) <> 0 Then
			foundstr="And A.ClassID in (" & ChildStr & ") Order By A.OrderID " & OrderType & ",A.ID " & OrderType
		Else
			foundstr="Order By A.OrderID " & OrderType & ",A.ID " & OrderType
		End If
		If CLng(SpecialID) <> 0 Then
			foundstr = "And A.SpecialID =" & CLng(SpecialID) & " " & foundstr
		End If
		Sql = " A.ID,A.ClassID,A.TColor,A.Title,A.IncludeInfo,A.IsPic,A.Pic,A.Hits,A.Tim,A.HtmlFileDate,"
		Sql = "Select Top " & CInt(TopNum) & Sql & " C.ClassName,C.HtmlFileDir From [" & ChannelDataName & "] A INNER JOIn [Class] C ON A.ClassID=C.ClassID Where A.Hidden=" & WK_True & " And A.IsDelete=" & WK_False & " And A.IsPic=" & WK_True & " And A.ChannelID=" & ChannelID & " " & foundstr & ""
		Call Exec(Rs,Sql,2)
		i = 0
		If Rs.BOF And Rs.EOF Then
			strContent = "<img src='" & InstallDir & "Images/no_pic.png' width='" & Width & "' height='" & Heitht & "' border='0' />"
		Else
			Do While Not Rs.EOF
				If strLen<>0 Then
					sTitle = Cuted(Rs("Title"), strLen)
				Else
					sTitle = Rs("Title")
				End If
				Pic=Code_Html(Rs("Pic"),1,0)
				If CInt(ChannelIsCreateHtml) = True Then
					HtmlFileName = ReadFileName(Rs("HtmlFileDate"), Rs("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, "")
					HtmlFileUrl = InstallDir & ChannelDir & "/" & Rs("HtmlFileDir") & ShowDatePath(Rs("HtmlFileDate"), ChannelHtmlPath) & HtmlFileName
				Else
					HtmlFileUrl = InstallDir & ChannelDir & "/View.asp?id=" & Rs("ID")
				End If

				files= files & "|" & Pic
				links= links & "|" & HtmlFileUrl
				texts= texts & "|" & sTitle
			Rs.movenext
			loop
			Rs.close
			If left(files,1)="|" Then files=right(files,len(files)-1)
			If left(links,1)="|" Then links=right(links,len(links)-1)
			If left(texts,1)="|" Then texts=right(texts,len(texts)-1)

			StrContent = vbcrlf&"<script type=""text/javascript"">"&_
			vbcrlf&"/****内容配置区******/"&_
			vbcrlf&"var titles = """ & texts & """;//如果不需要文本，将其留空"&_
			vbcrlf&"var imgs = """ & files & """"&_
			vbcrlf&"var urls = """ & links & """/********增加和删除选项个数需要同时增减titles,imgs,urls***********/"&_
			vbcrlf&"/********焦点图设置区**************/"&_
			vbcrlf&"var pw=" & Width & "; //宽度(必选)"&_
			vbcrlf&"var ph=" & Heitht & "; //高度(必选)"&_
			vbcrlf&"var Times=" & Times & " //间隔时间(可选,默认4000)"&_
			vbcrlf&"var sizes=" & Sizes & ";//文本链接的文字大小(可选，默认12px)"&_
			vbcrlf&"var isbold=""" & IsBold & """;//文本链接的文字是否加粗(可选，默认yes)"&_
			vbcrlf&"var txtcolor=0x" & TxtColor & "//文本链接的颜色(可选,默认FF7E00)"&_
			vbcrlf&"var txtLeft=" & TxtLeft & ";//文本链接左间距(可选,默认19)"&_
			vbcrlf&"var umcolor=0x" & UmColor & ";//数字按钮未选中时文本颜色(可选,默认FFFFFF)"&_
			vbcrlf&"var nubtouming=" & NubTouMing & ";//数字按钮未选中时透明度(可选,默认40)"&_
			vbcrlf&"var hovertouming=" & HoverTouMing & ";//数字按钮选中时透明度(可选,默认100)"&_
			vbcrlf&"var btnbg=0x" & BtnBg & "//数字按钮未选中时背景颜色(可选,默认FF7E00)"&_
			vbcrlf&"var bgnub=0x" & BgNub & ";//数字按钮选中时背景色(可选,默认FFFFFF)"&_
			vbcrlf&"var hovercolor=0x" & HoverColor & "//数字按钮选中时文本色(可选,默认FF0000)"&_
			vbcrlf&"var rname=""" & Rname & """;//右键菜单显示文字(可选,默认开心网络)"&_
			vbcrlf&"var rlink=""" & Rlink & """;//右键菜单链接(可选,默认http://www.kaixin100.cn)"&_
			vbcrlf&"/****焦点图装载（以下参数对应设置区）***/"&_
			vbcrlf&"document.write('<object classid=""clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"" codebase=""http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0"" width=""'+ pw +'"" height=""'+ ph +'"">');"&_
			vbcrlf&"document.write('<param name=""movie"" value=""" & InstallDir & "images/focusqq.swf""><param name=""allowFullScreen"" value=""true"">');"&_
			vbcrlf&"document.write('<param name=""allowScriptAccess"" value=""always""><param name=""quality"" value=""high"">');"&_
			vbcrlf&"document.write('<param name=""menu"" value=""false""><param name=""wmode"" value=""opaque"">');"&_
			vbcrlf&"document.write('<param name=""FlashVars"" value=""pw='+pw+'&ph='+ph+'&Times='+Times+'&sizes='+ sizes +'&isbold='+ isbold +'&umcolor='+ umcolor +'&bgnub='+ bgnub +'&btnbg='+ btnbg +'&hovercolor='+ hovercolor +'&txtcolor='+ txtcolor +'&txtLeft='+ txtLeft +'&nubtouming='+ nubtouming +'&hovertouming='+ hovertouming +'&rname='+ rname +'&rlink='+ rlink +'&urls='+ urls +'&titles='+ titles +'&imgs='+ imgs +'"">');"&_
			vbcrlf&"document.write('<embed src=""" & InstallDir & "images/focusqq.swf"" wmode=""opaque"" FlashVars=""pw='+pw+'&ph='+ph+'&Times='+Times+'&sizes='+ sizes +'&isbold='+ isbold +'&umcolor='+ umcolor +'&bgnub='+ bgnub +'&btnbg='+ btnbg +'&hovercolor='+ hovercolor +'&txtcolor='+ txtcolor +'&txtLeft='+ txtLeft +'&nubtouming='+ nubtouming +'&hovertouming='+ hovertouming +'&rname='+ rname +'&rlink='+ rlink +'&urls='+ urls +'&titles='+ titles +'&imgs='+ imgs +'"" menu=""false"" quality=""high"" width=""'+ pw +'"" height=""'+ ph +'"" type=""application/x-shockwave-flash"" pluginspage=""http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"" />');"&_
			vbcrlf&"document.write('</object>');"&_
			vbcrlf&"</script>"
		End If
		LoadChannelFlashqq = StrContent 
	End Function

	'================================================
	'函数名：ReadChannelFlashqq
	'作  用：读取模型Flash列表
	'参  数：strValue ----原字符串
	'================================================
	Public Function ReadChannelFlashqq(ByVal strValue)
		Dim strTemp
		strTemp = strValue
		regEx.Pattern = "\{\$ReadChannelFlashqq\((.*?)\)\}"
		Set Matches = regEx.Execute(strTemp)
		For Each Match In Matches
			strTemp = Replace(strTemp, Match.Value, GetFlashqqFromLabel(Match.SubMatches(0)))
		Next
		ReadChannelFlashqq = strTemp
	End Function
	
	Function GetFlashqqFromLabel(ByVal strSource)
        Dim ArrayList, tChannelID
        If strSource = "" Then
            GetFlashqqFromLabel = ""
            Exit Function
        End If
        strSource = Replace(strSource,Chr(34),"")
		strSource = FillInArrStr(strSource, "0", 20)
		ArrayList = Split(strSource, ",")
        If UBound(ArrayList) + 1 < 20 Then
            GetFlashqqFromLabel = "函数式标签：{$ReadChannelFlashqq(参数列表)}的参数个数不对。请检查模板中的此标签。"
            Exit Function
        End If
        Select Case Trim(ArrayList(0))
        Case "ChannelID"
            tChannelID = ChannelID
        Case Else
            tChannelID = ArrayList(0)
        End Select
        GetFlashqqFromLabel = LoadChannelFlashqq(tChannelID, ArrayList(1), ArrayList(2), ArrayList(3), ArrayList(4), ArrayList(5), ArrayList(6), ArrayList(7), ArrayList(8), ArrayList(9), ArrayList(10), ArrayList(11), ArrayList(12), ArrayList(13), ArrayList(14), ArrayList(15), ArrayList(16), ArrayList(17), ArrayList(18), ArrayList(19))
    End Function
	
	'================================================
	'函数名：LoadClass
	'作  用：装载栏目列表
	'参  数：ClassID   ----栏目ID
	'        ChannelID   ----模型ID
	'        TopNum   ----显示列表数
	'        strlen   ----显示标题长度
	'================================================
	Public Function LoadClass(ByVal ChannelID, ByVal ClassID, ByVal TopNum, ByVal strLen, ByVal newindow, ByVal styles, ByVal OrderType)
		Dim Rs,Sql,i,ChildCount,FolderType,FolderName,onMouseUp,ListType,strContent,ListStyle,ClassUrl,LinkTarget,sClassName
		
		ChannelID = ChkNumeric(ChannelID)
		ClassID = ChkNumeric(ClassID)
		strLen = ChkNumeric(strLen)
		ListStyle = Trim(styles)
		
		Call GetChannel(ChannelID)
		
		Sql="Select "
		If TopNum<>0 Then Sql=Sql&"Top " & CInt(TopNum)
		Sql=Sql&" * From Class Where ChannelID=" & ChannelID & " And ClassParent=" & ClassID & " Order By ClassOrder " & OrderType & ",ClassID " & OrderType
		Call Exe_Conn(Rs,Sql,1)
		If ClassID=0 and Rs.recordcount=0 Then
			strContent = strContent & "暂无栏目！"
		Else
		i=1
		while not Rs.eof
			ChildCount = Exec("","select count(*) from Class Where ChannelID=" & ChannelID & " And ClassParent=" & Rs("ClassID"),1)(0)
			If ChannelIsCreateHtml = True Then
				ClassUrl = InstallDir & ChannelDir & "/" & Rs("HtmlFileDir") & "Index" & ChannelHtmlExtName
			Else
				ClassUrl = InstallDir & ChannelDir & "/List.asp?ClassID=" & Rs("ClassID")
			End If
			If CInt(newindow) <> 0 Then
				LinkTarget = " target=""_blank"""
			Else
				LinkTarget = ""
			End If
			If strLen<>0 Then
				sClassName = Cuted(Rs("ClassName"), strLen)
			Else
				sClassName = Rs("ClassName")
			End If
			strContent = strContent & vbcrlf &"<div class='"&ListStyle&"'><a href='" & ClassUrl & "'" & LinkTarget & ">"&sClassName&"</a></div>"
			If ChildCount>0 Then
				strContent = strContent & LoadClass(ChannelID, Rs("ClassID"), TopNum, strLen, newindow, styles, OrderType)
			End If
		Rs.movenext
		i=i+1
		wend
		Rs.close
		set Rs=nothing
		End If
		LoadClass = strContent
	End Function
	
	'================================================
	'函数名：ReadClass
	'作  用：读取栏目列表
	'参  数：strValue ----原字符串
	'================================================
	Public Function ReadClass(ByVal strValue)
		Dim strTemp
		strTemp = strValue
		regEx.Pattern = "\{\$ReadClass\((.*?)\)\}"
		Set Matches = regEx.Execute(strTemp)
		For Each Match In Matches
			strTemp = Replace(strTemp, Match.Value, GetClassFromLabel(Match.SubMatches(0)))
		Next
		ReadClass = strTemp
	End Function
	
	Function GetClassFromLabel(ByVal strSource)
        Dim ArrayList, tChannelID
        If strSource = "" Then
            GetClassFromLabel = ""
            Exit Function
        End If
        strSource = Replace(strSource,Chr(34),"")
		strSource = FillInArrStr(strSource, "0", 7)
		ArrayList = Split(strSource, ",")
        If UBound(ArrayList) + 1 < 7 Then
            GetClassFromLabel = "函数式标签：{$ReadClass(参数列表)}的参数个数不对。请检查模板中的此标签。"
            Exit Function
        End If
        Select Case Trim(ArrayList(0))
        Case "ChannelID"
            tChannelID = ChannelID
        Case Else
            tChannelID = ArrayList(0)
        End Select
        GetClassFromLabel = LoadClass(tChannelID, ArrayList(1), ArrayList(2), ArrayList(3), ArrayList(4), ArrayList(5), ArrayList(6))
    End Function
	
	'================================================
	'函数名：LoadClassName
	'作  用：装载栏目标题
	'参  数：ClassID   ----栏目ID
	'        ChannelID   ----模型ID
	'        TopNum   ----显示列表数
	'        strlen   ----显示标题长度
	'================================================
	Public Function LoadClassName(ByVal ChannelID, ByVal ClassID, ByVal strLen)
		Dim Rs,Sql,i,ChildCount,FolderType,FolderName,onMouseUp,ListType,strContent
		
		ChannelID = ChkNumeric(ChannelID)
		ClassID = ChkNumeric(ClassID)
		strLen = ChkNumeric(strLen)
		
		Sql="Select * From Class Where ChannelID=" & ChannelID & " And ClassID=" & vCid
		Call Exe_Conn(Rs,Sql,1)
		If Rs.bof and Rs.eof Then
			strContent=""
			Exit Function
		End If
		If strLen<>0 Then
			strContent = Cuted(Rs("ClassName"), strLen)
		Else
			strContent = Rs("ClassName")
		End If
		Rs.close
		set Rs=nothing
		LoadClassName = strContent
	End Function
	
	'================================================
	'函数名：ReadClassName
	'作  用：读取栏目标题
	'参  数：strValue ----原字符串
	'================================================
	Public Function ReadClassName(ByVal strValue)
		Dim strTemp
		strTemp = strValue
		regEx.Pattern = "\{\$ReadClassName\((.*?)\)\}"
		Set Matches = regEx.Execute(strTemp)
		For Each Match In Matches
			strTemp = Replace(strTemp, Match.Value, GetClassNameFromLabel(Match.SubMatches(0)))
		Next
		ReadClassName = strTemp
	End Function
	
	Function GetClassNameFromLabel(ByVal strSource)
        Dim ArrayList, tChannelID
        If strSource = "" Then
            GetClassNameFromLabel = ""
            Exit Function
        End If
        strSource = Replace(strSource,Chr(34),"")
		strSource = FillInArrStr(strSource, "0", 3)
		ArrayList = Split(strSource, ",")
        If UBound(ArrayList) + 1 < 3 Then
            GetClassNameFromLabel = "函数式标签：{$ReadClassName(参数列表)}的参数个数不对。请检查模板中的此标签。"
            Exit Function
        End If
        Select Case Trim(ArrayList(0))
        Case "ChannelID"
            tChannelID = ChannelID
        Case Else
            tChannelID = ArrayList(0)
        End Select
        GetClassNameFromLabel = LoadClassName(tChannelID, ArrayList(1), ArrayList(2))
    End Function
	
	'================================================
	'函数名：SiteIndex
	'作  用：显示网站导页
	'参  数：返回/输出
	'================================================
	Public Function SiteIndex(ByVal IsHtml)
		Tit="导页"
		If Web_IndexMoban="" Then
			Web_IndexMoban="Index.html"
		End If
		HtmlContent = Template(Web_IndexMoban,Web_IndexSkinID,IsHtml)
		If isHtml Then
			SiteIndex = HtmlContent
		Else
			Response.Write HtmlContent
		End If
	End Function
	
	'================================================
	'函数名：SiteShow
	'作  用：显示网站首页
	'参  数：返回/输出
	'================================================
	Public Function SiteShow(ByVal IsHtml)
		Tit="首页"
		If Web_IndexShowMoban="" Then
			Web_IndexShowMoban="Show.html"
		End If
		HtmlContent = Template(Web_IndexShowMoban,Web_IndexShowSkinID,IsHtml)
		If isHtml Then
			SiteShow = HtmlContent
		Else
			Response.Write HtmlContent
		End If
	End Function
	
	Public Function ReplaceSql(TempSql) 
		Dim temp
		RegEx.Pattern = "\s(ChannelID)\s*=\s*0|\s(ClassID)\s*=\s*0|\s(ChannelID)\s*(in)\s*\(\s*0\s*\)|\s(ClassID)\s*(in)\s*\(\s*0\s*\)" 
		temp = RegEx.replace(TempSql," 1=1 ") 
		temp = Replace(temp,"{$WK_False}",WK_False)
		temp = Replace(temp,"{$WK_True}",WK_True)
		ReplaceSql = temp
	End Function 
	
	Public Function ReplaceCommonLabel()
		Dim rsLabel, nonLabel, LabelNum, Looptotalnum, PageNum, reFlashTime
		Dim DyTemp, LoopTemp, loopTempMatch, loopTempMatch2, InfoTemp, InfoTempMatch, FieldTemp, FieldArry, FieldTempText
		Dim rsLabelRe, InfoID, TempSql
		Dim arrAreaCode, arrAreaCode2, i
		Dim CaiTemp, rsArea
		Dim strChannel, strLogo, strBanner, strTopUser, strAuthorList, strProducerList, strFriendSite, strAnnounce, strPopAnnouce
		Dim strTemp, arrTemp
		Dim Match2, MatchesInfo, Match3, Matches3
		HtmlContent = Code_Replace(HtmlContent, "%7B", "{")
		HtmlContent = Code_Replace(HtmlContent, "%7D", "}")
		HtmlContent = Code_Replace(HtmlContent, "{$InstallDir}{$ChannelDir}", ChannelUrl)
		
		'以下这段代码放在最前面，是用于在自定义动态函数标签中可以解析个别标签
		'{$InstallDir}{$ChannelDir}的替换一定要放在单个{$ChannelDir}的前面
		If ChannelID > 0 Then
			HtmlContent = Code_Replace(HtmlContent, "{$InstallDir}{$ChannelDir}", ChannelUrl)
			HtmlContent = Code_Replace(HtmlContent, "{$ChannelID}", ChannelID)
			HtmlContent = Code_Replace(HtmlContent, "{$ChannelDir}", ChannelDir)
			HtmlContent = Code_Replace(HtmlContent, "{$ChannelUrl}", ChannelUrl)
		End If
		
		'解决编辑器过滤为标签值为空问题
		regEx.Pattern = "(\s)+(value|title|src|href)(\s)*\=(\s)*\{\$(.[^\<\{]*)\}"
		Set Matches = regEx.Execute(HtmlContent)
		For Each Match In Matches
			strTemp = Replace(Trim(Match.Value), "{$", """{$")
			strTemp = Replace(strTemp, "}", "}""")
			HtmlContent = Replace(HtmlContent, Match.Value, " " & strTemp)
		Next
		
		Looptotalnum = 10
		If InStr(HtmlContent, "{$WK_") > 0 Then
			LabelNum = 1
		Else
			LabelNum = 0
		End If
		Do While LabelNum > 0
			nonLabel = True
			'替换静态标签
			Call Exec(rsLabel,"select LabelName,LabelContent from Label where LabelType=0 order by Priority asc,LabelID asc",2)
			Do While Not rsLabel.EOF
				If InStr(HtmlContent, "{$" & rsLabel("LabelName")) > 0 Then
					If InStr(HtmlContent, "{$" & rsLabel("LabelName") & "}") > 0 Then
						HtmlContent = Replace(HtmlContent, "{$" & rsLabel("LabelName") & "}", rsLabel("LabelContent"))
					Else
						regEx.Pattern = "\{\$" & rsLabel("LabelName") & "\((.*?)\)\}"
						Set Matches = regEx.Execute(HtmlContent)
						For Each Match In Matches
							InfoTemp = rsLabel("LabelContent")
							arrTemp = Split(Match.SubMatches(0), ",")
							For i = 0 To UBound(arrTemp)
								InfoTemp = Replace(InfoTemp, "{input(" & i & ")}", arrTemp(i))
							Next
							HtmlContent = Replace(HtmlContent, Match.Value, InfoTemp)
						Next
					End If
					nonLabel = False
				End If
				rsLabel.MoveNext
			Loop
		
			'替换动态标签
			Call Exec(rsLabel,"select LabelID,LabelName,LabelType,PageNum,LabelIntro,LabelContent,reFlashTime from Label where LabelType=1 or LabelType=2 order by Priority asc,LabelID asc",2)
			Do While Not rsLabel.EOF
			PageNum = rsLabel("PageNum")
			reFlashTime = rsLabel("reFlashTime")
		
			If InStr(HtmlContent, "{$" & rsLabel("LabelName")) > 0 Then
				Dim temptime, temptimetext, dyfoot
				LoopTemp = rsLabel("LabelContent")
				LoopTemp = Replace(LoopTemp,"{$InstallDir}{$Field(0,GetUrl","{$Field(0,GetUrl")		
				LoopTemp = Replace(Replace(Replace(Replace(LoopTemp, "{$Now}", Now()), "{$NowDay}", Day(Now())), "{$NowMonth}", Month(Now())), "{$NowYear}", Year(Now()))
				regEx.Pattern = "\{Loop\}([\s\S]*?)\{\/Loop\}"
				Set Matches = regEx.Execute(LoopTemp)
				For Each Match In Matches
					loopTempMatch = Match.Value
				Next
				LoopTemp = regEx.Replace(LoopTemp, "{$SqlReplaceText}")
				loopTempMatch = Replace(Replace(loopTempMatch, "{loop}", ""), "{/loop}", "")
		
				Select Case rsLabel("LabelType")
				Case 1 '标准动态标签的处理过程
					TempSql = Replace(Replace(Replace(Replace(Replace(rsLabel("LabelIntro"), "{$Now}", Now()), "{$NowDay}", Day(Now())), "{$NowMonth}", Month(Now())), "{$NowYear}", Year(Now())),"{$WK_DatePart_D}", WK_DatePart_D)
					TempSql = Replace(Replace(Replace(Replace(TempSql, "{$WK_True}", WK_True), "{$WK_False}", WK_False), "{$WK_Now}", WK_Now), "{$WK_OrderType}", WK_OrderType)
					If InStr(HtmlContent, "{$" & rsLabel("LabelName") & "}") > 0 Then
		
						'开始循环处理内容
						InfoID = 0
						On Error Resume Next
						TempSql = Replacesql(TempSql)
						Call Exe_Conn(rsLabelRe,TempSql,1)
						If Err Then
							Err.Clear
							DyTemp = "SQL查询错误"
						Else
							totalPut = rsLabelRe.RecordCount
							If rsLabelRe.BOF And rsLabelRe.EOF Then
								DyTemp = "尚无数据"
							Else
								loopTempMatch = Replace(Replace(Replace(Replace(loopTempMatch, "{$Now}", Now()), "{$NowDay}", Day(Now())), "{$NowMonth}", Month(Now())), "{$NowYear}", Year(Now()))
								Do While Not rsLabelRe.EOF
								regEx.Pattern = "\{Infobegin\}([\s\S]*?)\{Infoend\}"
								Set Matches = regEx.Execute(loopTempMatch)
						 
								If Matches.Count = 0 Then
									rsLabelRe.MoveNext
								Else
									For Each Match In Matches
										If Not rsLabelRe.EOF Then
											InfoTemp = Match.Value
											InfoTempMatch = Replace(Replace(InfoTemp, "{Infobegin}", ""), "{Infoend}", "") '得到最终的单一字段内容
											regEx.Pattern = "\{\$Field\((.*?)\)\}"
											Set MatchesInfo = regEx.Execute(InfoTempMatch)
											For Each Match2 In MatchesInfo
												FieldTemp = Match2.Value
												FieldArry = Split(Match2.SubMatches(0), ",")
												If UBound(FieldArry) > 1 Then '参数正确,进行处理
													Select Case FieldArry(1)
													Case "Text" '按文本方式输出内容
														If rsLabelRe(Code_CLng(FieldArry(0))) = "" Or IsNull(rsLabelRe(Code_CLng(FieldArry(0)))) Then
															FieldTempText = ""
														Else
															If FieldArry(2) = 0 Then
																Select Case FieldArry(3)
																Case 1
																	FieldTempText = Replace(rsLabelRe(Code_CLng(FieldArry(0))), "<", "&lt;")
																Case 2
																	FieldTempText = nohtml(rsLabelRe(Code_CLng(FieldArry(0))))
																Case Else
																	FieldTempText = rsLabelRe(Code_CLng(FieldArry(0)))
																End Select
															Else
																Select Case FieldArry(3)
																Case 1
																	If FieldArry(4) = 0 Then
																		FieldTempText = GetSubStr(Replace(rsLabelRe(Code_CLng(FieldArry(0))), "<", "&lt;"), Code_CLng(FieldArry(2)), True)
																	Else
																		FieldTempText = GetSubStr(Replace(rsLabelRe(Code_CLng(FieldArry(0))), "<", "&lt;"), Code_CLng(FieldArry(2)), False)
																	End If
																Case 2
																	If FieldArry(4) = 0 Then
																		FieldTempText = GetSubStr(nohtml(rsLabelRe(Code_CLng(FieldArry(0)))), Code_CLng(FieldArry(2)), True)
																		FieldTempText = Replace(FieldTempText, Chr(10), "<br>")
																	Else
																		FieldTempText = GetSubStr(nohtml(rsLabelRe(Code_CLng(FieldArry(0)))), Code_CLng(FieldArry(2)), False)
																		FieldTempText = Replace(FieldTempText, Chr(10), "<br>")
																	End If
																Case Else
																	If FieldArry(4) = 0 Then
																		FieldTempText = GetSubStr(rsLabelRe(Code_CLng(FieldArry(0))), Code_CLng(FieldArry(2)), True)
																	Else
																		FieldTempText = GetSubStr(rsLabelRe(Code_CLng(FieldArry(0))), Code_CLng(FieldArry(2)), False)
																	End If
																End Select
															End If
														 End If
													Case "Num" '按数字方式输出内容
														If rsLabelRe(Code_CLng(FieldArry(0))) = "" Or IsNull(rsLabelRe(Code_CLng(FieldArry(0)))) Then
															FieldTempText = "0"
														Else
															Select Case FieldArry(2)
															Case 0
																If FieldArry(3) = "0" Then
																	FieldTempText = Int(rsLabelRe(Code_CLng(FieldArry(0))))
																Else
																	FieldTempText = String(Int(rsLabelRe(Code_CLng(FieldArry(0)))), FieldArry(3))
																End If
															Case 1
																FieldTempText = FormatNumber(rsLabelRe(Code_CLng(FieldArry(0))), FieldArry(3))
															Case 2
																FieldTempText = FormatPercent(rsLabelRe(Code_CLng(FieldArry(0))))
															End Select
													   End If
													Case "Time" '按时间方式输出内容
														If rsLabelRe(Code_CLng(FieldArry(0))) = "" Or IsNull(rsLabelRe(Code_CLng(FieldArry(0)))) Then
															FieldTempText = ""
														Else
															If IsDate(rsLabelRe(Code_CLng(FieldArry(0)))) Then '判断字段类型是否正确
																temptime = rsLabelRe(Code_CLng(FieldArry(0)))
																Select Case FieldArry(2)
																Case 0
																	FieldTempText = Replace(Replace(Replace(Replace(Replace(Replace(FieldArry(3), "{year}", Year(temptime)), "{month}", Month(temptime)), "{day}", Day(temptime)), "{Hour}", Hour(temptime)), "{Minute}", Minute(temptime)), "{Second}", Second(temptime))
																Case 1, 2
																	If FieldArry(2) = 1 Then
																		temptimetext = Replace(FieldArry(3), "{year}", Year(temptime))
																	Else
																		temptimetext = Replace(FieldArry(3), "{year}", Right(Year(temptime), 2))
																	End If
																	If Len(Month(temptime)) = 1 Then
																		temptimetext = Replace(temptimetext, "{month}", "0" & Month(temptime))
																	Else
																		temptimetext = Replace(temptimetext, "{month}", Month(temptime))
																	End If
																	If Len(Day(temptime)) = 1 Then
																		temptimetext = Replace(temptimetext, "{day}", "0" & Day(temptime))
																	Else
																		temptimetext = Replace(temptimetext, "{day}", Day(temptime))
																	End If
																	FieldTempText = temptimetext
																Case 3
																	FieldTempText = FormatDateTime(temptime, Code_CLng(FieldArry(3)))
																End Select
															Else
																FieldTempText = "本字段非时间型"
															End If
														End If
													Case "yn" '按是否方式输出内容
														If rsLabelRe(Code_CLng(FieldArry(0))) = "" Or IsNull(rsLabelRe(Code_CLng(FieldArry(0)))) Then
															FieldTempText = ""
														Else
															If rsLabelRe(Code_CLng(FieldArry(0))) = True Then
																FieldTempText = FieldArry(2)
															Else
																FieldTempText = FieldArry(3)
															End If
														End If
													Case "GetUrl"
														FieldTempText = GetInfoUrl(rsLabelRe(Code_CLng(FieldArry(0))), FieldArry(2), FieldArry(3))
													Case "GetClass"
														FieldTempText = GetInfoClass(rsLabelRe(Code_CLng(FieldArry(0))), FieldArry(2))
													Case "GetChannel"
														FieldTempText = GetInfoChannel(rsLabelRe(Code_CLng(FieldArry(0))), FieldArry(2))
													Case Else
														FieldTempText = "标签参数错误"
													End Select
												Else
													FieldTempText = "标签参数错误"
												End If
												If Trim(FieldTempText & "") = "" Then
													InfoTempMatch = Replace(InfoTempMatch, FieldTemp, "")
												Else
													InfoTempMatch = Replace(InfoTempMatch, FieldTemp, FieldTempText)
												End If
											Next
											DyTemp = DyTemp & Replace(InfoTempMatch, "{$AutoID}", InfoID + 1)
											rsLabelRe.MoveNext
											InfoID = InfoID + 1
											If PageNum > 0 Then
												If InfoID >= rsLabel("PageNum") Then Exit Do
											End If
										End If
										Next
									End If
								Loop
							End If
						End If
						rsLabelRe.Close
						LoopTemp = Replace(LoopTemp, "{$SqlReplaceText}", DyTemp)
						LoopTemp = Replace(LoopTemp, "{$totalPut}", totalPut)
						If (PageNum > 0 And totalPut > PageNum) Or (reFlashTime > 10 And totalPut > 0) Then '如有分页属性或者刷新时间大于10秒,则加入DIV
							dyfoot = "<script language=""JavaScript"" type=""text/JavaScript"">ShowDynaPage(" & rsLabel("LabelID") & ",1," & reFlashTime & ",'" & strInstallDir & "','none');</script>"
							LoopTemp = Replace(Replace(Replace(XmlText("BaseText", "DynaPage", "<div id=""dyna_body_{wkid}"">{dybody}</div><div id=""dyna_page_{wkid}"" style=""text-align: right;"">{dyfoot}</div>"), "{wkid}", rsLabel("LabelID")), "{dybody}", LoopTemp), "{dyfoot}", dyfoot)
						End If
						HtmlContent = Replace(HtmlContent, "{$" & rsLabel("LabelName") & "}", LoopTemp)
					End If
				Case 2 '函数型动态标签的处理过程
						Dim tempvalue, loopTemp2
						loopTemp2 = LoopTemp
						loopTempMatch2 = loopTempMatch
						regEx.Pattern = "\{\$" & rsLabel("LabelName") & "\((.*?)\)\}"
						Set Matches3 = regEx.Execute(HtmlContent)
						For Each Match3 In Matches3
							TempSql = Replace(Replace(Replace(Replace(Replace(rsLabel("LabelIntro"), "{$Now}", Now()), "{$NowDay}", Day(Now())), "{$NowMonth}", Month(Now())), "{$NowYear}", Year(Now())),"{$WK_DatePart_D}", WK_DatePart_D)
							TempSql = Replace(Replace(Replace(Replace(TempSql, "{$WK_True}", WK_True), "{$WK_False}", WK_False), "{$WK_Now}", WK_Now), "{$WK_OrderType}", WK_OrderType)
							LoopTemp = loopTemp2
							loopTempMatch = loopTempMatch2
							DyTemp = ""
							tempvalue = ""						
							Dim TempNum, IsEnd
							IsEnd = True
							TempNum = 0
							arrTemp = Split(Match3.SubMatches(0), ",")
							ReDim arrTem(CInt(UBound(arrTemp)))
							For i = 0 To UBound(arrTemp)
								If InStr(arrTemp(i), "[") > 0 Then
									IsEnd = False
									arrTemp(i) = Replace(arrTemp(i), "[", "")
								End If
								If InStr(arrTemp(i), "]") > 0 Then
									IsEnd = True
									arrTemp(i) = Replace(arrTemp(i), "]", "")
								End If
								If IsEnd = False Then
									arrTem(TempNum) = arrTem(TempNum) & arrTemp(i) & ","
								End If
								If IsEnd = True Then
									arrTem(TempNum) = arrTem(TempNum) & arrTemp(i)
		
									TempSql = Replace(TempSql, "{input(" & TempNum & ")}", ReplaceLabelBadChar(arrTem(TempNum))) 
									loopTempMatch = Replace(loopTempMatch, "{input(" & TempNum & ")}", arrTem(TempNum))
									tempvalue = tempvalue & arrTem(TempNum) & "|"
									TempNum = TempNum + 1
								End If
							Next
							TempSql = Replacesql(TempSql)
							'开始循环处理内容
							InfoID = 0
							On Error Resume Next
							Call Exe_Conn(rsLabelRe,TempSql,1)
							If Err Then
								Err.Clear
								DyTemp = "SQL查询错误"
							Else
								totalPut = rsLabelRe.RecordCount
								If rsLabelRe.BOF And rsLabelRe.EOF Then
									DyTemp = "尚无数据"
								Else
									Do While Not rsLabelRe.EOF
									regEx.Pattern = "\{Infobegin\}([\s\S]*?)\{Infoend\}"
									Set Matches = regEx.Execute(loopTempMatch)
									If Matches.Count = 0 Then
										rsLabelRe.MoveNext
									Else
										For Each Match In Matches
											If Not rsLabelRe.EOF Then
												InfoTemp = Match.Value
												InfoTempMatch = Replace(Replace(InfoTemp, "{Infobegin}", ""), "{Infoend}", "") '得到最终的单一字段内容
												regEx.Pattern = "\{\$Field\((.*?)\)\}"
												Set MatchesInfo = regEx.Execute(InfoTempMatch)
												For Each Match2 In MatchesInfo
													FieldTemp = Match2.Value
													FieldArry = Split(Match2.SubMatches(0), ",")
													If UBound(FieldArry) > 1 Then '参数正确,进行处理
														Select Case FieldArry(1)
														Case "Text" '按文本方式输出内容
															If rsLabelRe(Code_CLng(FieldArry(0))) = "" Or IsNull(rsLabelRe(Code_CLng(FieldArry(0)))) Then
																FieldTempText = ""
															Else
																If FieldArry(2) = 0 Then
																	Select Case FieldArry(3)
																	Case 1
																		FieldTempText = Replace(rsLabelRe(Code_CLng(FieldArry(0))), "<", "&lt;")
																	Case 2
																		FieldTempText = nohtml(rsLabelRe(Code_CLng(FieldArry(0))))
																		FieldTempText = Replace(FieldTempText, Chr(10), "<br>")
																	Case Else
																		FieldTempText = rsLabelRe(Code_CLng(FieldArry(0)))
																	End Select
																Else
																	Select Case FieldArry(3)
																	Case 1
																		If FieldArry(4) = 0 Then
																			FieldTempText = GetSubStr(Replace(rsLabelRe(Code_CLng(FieldArry(0))), "<", "&lt;"), Code_CLng(FieldArry(2)), True)
																		Else
																			FieldTempText = GetSubStr(Replace(rsLabelRe(Code_CLng(FieldArry(0))), "<", "&lt;"), Code_CLng(FieldArry(2)), False)
																		End If
																	Case 2
																		If FieldArry(4) = 0 Then
																			FieldTempText = GetSubStr(nohtml(rsLabelRe(Code_CLng(FieldArry(0)))), Code_CLng(FieldArry(2)), True)                                           
																			FieldTempText = Replace(FieldTempText, Chr(10), "<br>")
																		Else
																			FieldTempText = GetSubStr(nohtml(rsLabelRe(Code_CLng(FieldArry(0)))), Code_CLng(FieldArry(2)), False)
																			FieldTempText = Replace(FieldTempText, Chr(10), "<br>")
																		End If
																	Case Else
																		If FieldArry(4) = 0 Then
																			FieldTempText = GetSubStr(rsLabelRe(Code_CLng(FieldArry(0))), Code_CLng(FieldArry(2)), True)
																		Else
																			FieldTempText = GetSubStr(rsLabelRe(Code_CLng(FieldArry(0))), Code_CLng(FieldArry(2)), False)
																		End If
																	End Select
																End If
															End If
														Case "Num" '按数字方式输出内容
															If rsLabelRe(Code_CLng(FieldArry(0))) = "" Or IsNull(rsLabelRe(Code_CLng(FieldArry(0)))) Then
																FieldTempText = "0"
															Else
																Select Case FieldArry(2)
																Case 0
																	If FieldArry(3) = "0" Then
																		FieldTempText = Int(rsLabelRe(Code_CLng(FieldArry(0))))
																	Else
																		FieldTempText = String(Int(rsLabelRe(Code_CLng(FieldArry(0)))), FieldArry(3))
																	End If
																Case 1
																	FieldTempText = FormatNumber(rsLabelRe(Code_CLng(FieldArry(0))), FieldArry(3))
																Case 2
																	FieldTempText = FormatPercent(rsLabelRe(Code_CLng(FieldArry(0))))
																End Select
															End If
														Case "Time" '按时间方式输出内容
															If rsLabelRe(Code_CLng(FieldArry(0))) = "" Or IsNull(rsLabelRe(Code_CLng(FieldArry(0)))) Then
																FieldTempText = ""
															Else
																If IsDate(rsLabelRe(Code_CLng(FieldArry(0)))) Then '判断字段类型是否正确
																	temptime = rsLabelRe(Code_CLng(FieldArry(0)))
																	Select Case FieldArry(2)
																	Case 0
																		FieldTempText = Replace(Replace(Replace(Replace(Replace(Replace(FieldArry(3), "{year}", Year(temptime)), "{month}", Month(temptime)), "{day}", Day(temptime)), "{Hour}", Hour(temptime)), "{Minute}", Minute(temptime)), "{Second}", Second(temptime))
																	Case 1, 2
																		If FieldArry(2) = 1 Then
																			temptimetext = Replace(FieldArry(3), "{year}", Year(temptime))
																		Else
																			temptimetext = Replace(FieldArry(3), "{year}", Right(Year(temptime), 2))
																		End If
																		If Len(Month(temptime)) = 1 Then
																			temptimetext = Replace(temptimetext, "{month}", "0" & Month(temptime))
																		Else
																			temptimetext = Replace(temptimetext, "{month}", Month(temptime))
																		End If
																		If Len(Day(temptime)) = 1 Then
																			temptimetext = Replace(temptimetext, "{day}", "0" & Day(temptime))
																		Else
																			temptimetext = Replace(temptimetext, "{day}", Day(temptime))
																		End If
																		FieldTempText = temptimetext
																	Case 3
																		FieldTempText = FormatDateTime(temptime, Code_CLng(FieldArry(3)))
																	End Select
																Else
																	FieldTempText = "本字段非时间型"
																End If
															End If
														Case "yn" '按是否方式输出内容
															If rsLabelRe(Code_CLng(FieldArry(0))) = "" Or IsNull(rsLabelRe(Code_CLng(FieldArry(0)))) Then
																FieldTempText = ""
															Else
																If rsLabelRe(Code_CLng(FieldArry(0))) = True Then
																	FieldTempText = FieldArry(2)
																Else
																	FieldTempText = FieldArry(3)
																End If
															End If
														Case "GetUrl"
															FieldTempText = GetInfoUrl(rsLabelRe(Code_CLng(FieldArry(0))), FieldArry(2), FieldArry(3))
														Case "GetClass"
															FieldTempText = GetInfoClass(rsLabelRe(Code_CLng(FieldArry(0))), FieldArry(2))
														Case "GetChannel"
															FieldTempText = GetInfoChannel(rsLabelRe(Code_CLng(FieldArry(0))), FieldArry(2))
														Case Else
															FieldTempText = "标签参数错误"
														End Select
													Else
														FieldTempText = "标签参数错误"
													End If
													InfoTempMatch = Replace(InfoTempMatch, FieldTemp, FieldTempText)
												Next
												DyTemp = DyTemp & Replace(InfoTempMatch, "{$AutoID}", InfoID + 1)
												rsLabelRe.MoveNext
												InfoID = InfoID + 1
												If PageNum > 0 Then
													If InfoID >= PageNum Then Exit Do
												End If
											End If
										Next
									End If
								Loop
							End If
							End If
							rsLabelRe.Close
		
							LoopTemp = Replace(LoopTemp, "{$SqlReplaceText}", DyTemp)
							LoopTemp = Replace(LoopTemp, "{$totalPut}", totalPut)
							For i = 0 To UBound(arrTemp)
								LoopTemp = Replace(LoopTemp, "{input(" & i & ")}", arrTem(i))
							Next
							If (PageNum > 0 And totalPut > PageNum) Or (reFlashTime > 10 And totalPut > 0) Then '如有分页属性或者刷新时间大于10秒,则加入DIV
								dyfoot = "<script language=""JavaScript"" type=""text/JavaScript"">ShowDynaPage(" & rsLabel("LabelID") & ",1," & reFlashTime & ",'" & strInstallDir & "','" & tempvalue & "');</script>"
								LoopTemp = Replace(Replace(Replace(XmlText("BaseText", "DynaPage", "<div id=""dyna_body_{wkid}"">{dybody}</div><div id=""dyna_page_{wkid}"" style=""text-align: right;"">{dyfoot}</div>"), "{wkid}", rsLabel("LabelID")), "{dybody}", LoopTemp), "{dyfoot}", dyfoot)
							End If
							HtmlContent = Replace(HtmlContent, Match3.Value, LoopTemp)
						Next
				End Select
				DyTemp = ""
				nonLabel = False
			End If
			rsLabel.MoveNext
			Loop
			Set rsLabelRe = Nothing
			Set MatchesInfo = Nothing
		
			If nonLabel = True Then
				LabelNum = 0
				Exit Do
			Else
				If InStr(HtmlContent, "{$WK_") > 0 Then
					LabelNum = 1
					If Looptotalnum > 0 Then
						Looptotalnum = Looptotalnum - 1
					Else
						LabelNum = 0
						Exit Do
					End If
				Else
					LabelNum = 0
					Exit Do
				End If
			End If
			rsLabel.Close
			Set rsLabel = Nothing
		Loop
		HtmlContent = Code_Replace(HtmlContent, "%7B", "{")
		HtmlContent = Code_Replace(HtmlContent, "%7D", "}") 
		HtmlContent = Replace(HtmlContent, "<!--{$", "{$")
		HtmlContent = Replace(HtmlContent, "}-->", "}") 
		regEx.Pattern = "\{\$InstallDir\}(?!\{\$ChannelDir\})"
		HtmlContent = regEx.Replace(HtmlContent, InstallDir)
		HtmlContent = Code_Replace(HtmlContent, "{$SiteUrl}", SiteUrl)
		HtmlContent = Code_Replace(HtmlContent, "{$SiteName}", SiteName)
		HtmlContent = Code_Replace(HtmlContent, "{$WebmasterEmail}", WebmasterEmail)
		HtmlContent = Code_Replace(HtmlContent, "{$WebmasterName}", WebmasterName)
		HtmlContent = Code_Replace(HtmlContent, "{$SiteCopyRight}", SiteCopyRight)
		HtmlContent = Code_Replace(HtmlContent, "{$SiteKeywords}", SiteKeywords)
		HtmlContent = Code_Replace(HtmlContent, "{$SiteDescription}", SiteDescription)
		HtmlContent = Code_Replace(HtmlContent, "{$SiteAuthor}", SiteAuthor)
		If InStr(HtmlContent, "{$LogoUrl}") > 0 Then HtmlContent = Replace(HtmlContent, "{$LogoUrl}", LogoUrl)
		If InStr(HtmlContent, "{$LogoWidth}") > 0 Then HtmlContent = Replace(HtmlContent, "{$LogoWidth}", LogoWidth)
		If InStr(HtmlContent, "{$LogoHeight}") > 0 Then HtmlContent = Replace(HtmlContent, "{$LogoHeight}", LogoHeight)
		If InStr(HtmlContent, "{$AdminFolder}") > 0 Then HtmlContent = Replace(HtmlContent, "{$AdminFolder}", AdminFolder)  	 
		
		If ChannelID > 0 Then
			HtmlContent = Code_Replace(HtmlContent, "{$InstallDir}{$ChannelDir}", ChannelUrl)
			HtmlContent = Code_Replace(HtmlContent, "{$ChannelID}", ChannelID)
			HtmlContent = Code_Replace(HtmlContent, "{$ChannelDir}", ChannelDir)
			HtmlContent = Code_Replace(HtmlContent, "{$ChannelUrl}", ChannelUrl)
			HtmlContent = Code_Replace(HtmlContent, "{$ChannelName}", ChannelName)
			HtmlContent = Code_Replace(HtmlContent, "{$ChannelTit}", ChannelTit)
			HtmlContent = Code_Replace(HtmlContent, "{$UploadDir}", ChannelUploadDir)
		End If
		ReplaceCommonLabel = HtmlContent
	End Function
	
	'==================================================
	'函数名：GetInfoChannel
	'作  用：获取对象的模型参数
	'参  数：InfoID ------对象ID
	'      ：OutType -----输出方式
	'==================================================
	Public Function GetInfoChannel(InfoID, OutType)

	If IsNull(InfoID) = True Or IsNull(OutType) = True Then
		GetInfoChannel = ""
		Exit Function
	End If
	Dim sqlInfo, rsInfo, rsChannel2, strTemp
	sqlInfo = "select top 1 ChannelID,ChannelName,LinkUrl,ChannelDir,ChannelHidden,UploadDir from Channel Where ChannelID=" & Code_CLng(InfoID)
	Call Exec(rsInfo,sqlInfo,2)
	If Not (rsInfo.BOF And rsInfo.EOF) Then
		If rsInfo("ChannelHidden") = True Then
				strTemp = ""
		Else
			Select Case OutType
			Case 1
				If IsNull(rsInfo("ChannelDir")) Then
					strTemp = rsInfo("LinkUrl")
				Else
					strTemp = rsInfo("ChannelDir")
				End If
			Case 2
				strTemp = rsInfo("ChannelName")
			Case 3
				strTemp = rsInfo("UploadDir")
			Case Else
				strTemp = "标签参数错"
			End Select
		End If
	End If
	rsInfo.Close
	Set rsInfo = Nothing
	GetInfoChannel = strTemp
	End Function
	
	'==================================================
	'函数名：GetInfoUrl
	'作  用：获取对象的路径
	'参  数：InfoID ------对象ID
	'      ：DataType ------数据库名称
	'==================================================
	Public Function GetInfoUrl(InfoID, DataType, OutType)
	If IsNull(InfoID) = True Or IsNull(DataType) = True Or IsNull(OutType) = True Then
		GetInfoUrl = ""
		Exit Function
	End If
	Dim sqlInfo, rsInfo, rsChannel2, strTemp
	Dim ChannelDir, StructureType, FileNameType, FileExtType, CacheTemp, ChannelTemp,ChannelUrl
	
	Call GetChannel(DataType)
	
	sqlInfo = "select top 1 A.ID,A.ChannelID,A.ClassID,A.Title,A.Tim,A.HtmlFileDate,C.ClassDir,C.HtmlFileDir from " & ChannelDataName & " A Left join Class C on A.ClassID=C.ClassID Where A.ID=" & Code_CLng(InfoID)
	Call Exec(rsInfo,sqlInfo,2)
	If Not (rsInfo.BOF And rsInfo.EOF) Then
		If strTemp <> InfoID Then
			If rsInfo(1)>0 Then
				ChannelDir = Exec("","select ChannelDir from Channel where ChannelID="&rsInfo(1),1)(0)
			End If
			Select Case OutType
			Case 1
				If ChannelIsCreateHtml = True Then
					strTemp = InstallDir & ChannelDir & "/" & rsInfo(7) & ShowDatePath(rsInfo(5), ChannelHtmlPath) & ReadFileName(rsInfo(5), rsInfo(0), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, "")
				Else
					strTemp = InstallDir & ChannelDir & "/View.asp?id=" & rsInfo(0)
				End If
			Case 2
				strTemp = rsInfo(3)
			Case 3
				If ChannelIsCreateHtml = True Then
					strTemp = "<a href='" & InstallDir & ChannelDir & "/" & rsInfo(7) & ShowDatePath(rsInfo(5), ChannelHtmlPath) & ReadFileName(rsInfo(5), rsInfo(0), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, "") & "'>" & rsInfo(3) & "</a>"
				Else
					strTemp = "<a href='" & InstallDir & ChannelDir & "/View.asp?id=" & rsInfo(0) & "'>" & rsInfo(3) & "</a>"
				End If
			Case Else
				strTemp = "标签参数错误"
			End Select
		End If
	End If
	rsInfo.Close
	Set rsInfo = Nothing
	GetInfoUrl = strTemp
	End Function
	
	'==================================================
	'函数名：GetInfoClass
	'作  用：获取对象的栏目
	'参  数：InfoID ------对象ID
	'      ：DataType ------数据库名称
	'==================================================
	Public Function GetInfoClass(InfoID, OutType)
	If IsNull(InfoID) = True Or IsNull(OutType) = True Then
		GetInfoClass = ""
		Exit Function
	End If
	Dim sqlInfo, rsInfo, rsChannel2, strTemp, PriChannelID
	Dim ChannelDir, ModuleType, StructureType, ListFileType, FileExtList
	sqlInfo = "select top 1 ClassID,ChannelID,ClassName,ClassDir,HtmlFileDir from Class Where ClassID=" & Code_CLng(InfoID)
	Call Exec(rsInfo,sqlInfo,2)
	If Not (rsInfo.BOF And rsInfo.EOF) Then
		If rsInfo("ChannelID")>0 Then
			Call Exec(rsChannel2,"select ChannelID,ChannelDir,ModuleType,IsCreateHtml,HtmlExtName from Channel Where ChannelID=" & rsInfo("ChannelID") & " and ChannelHidden=" & WK_False,2)
			If Not (rsChannel2.BOF And rsChannel2.EOF) Then
				ChannelDir = rsChannel2("ChannelDir")
				ModuleType = rsChannel2("ModuleType")
				IsCreateHtml = rsChannel2("IsCreateHtml")
				HtmlExtName = rsChannel2("HtmlExtName")
				ChannelID = rsInfo("ChannelID")
			Else
				strTemp = "栏目不存在"
			End If
			rsChannel2.Close
			Set rsChannel2 = Nothing
		End If
	
		If strTemp <> "栏目不存在" Then
			Select Case OutType
			Case 1
				If IsCreateHtml = True Then
					strTemp = InstallDir & ChannelDir & "/" & rsInfo("HtmlFileDir") & "Index" & HtmlExtName
				Else
					strTemp = InstallDir & ChannelDir & "/List.asp?ClassID=" & rsInfo("ClassID")
				End If
			Case 2
				strTemp = rsInfo("ClassName")
			Case 3
				If IsCreateHtml = True Then
					strTemp = "<a href='" & InstallDir & ChannelDir & "/" & rsInfo("HtmlFileDir") & "Index" & HtmlExtName & "'>" & rsInfo("ClassName") & "</a>"
				Else
					strTemp = "<a href='" & InstallDir & ChannelDir & "/List.asp?ClassID=" & rsInfo("ClassID") & "'>" & rsInfo("ClassName") & "</a>"
				End If
			Case Else
				strTemp = "标签参数错"
			End Select
			GetInfoClass = strTemp
		Else
			GetInfoClass = ""
		End If
	End If
	rsInfo.Close
	Set rsInfo = Nothing
	End Function
	
	'替换循环标签
	Public Function ParseLoop()
		dim sortArr,sortI,labelRule,labelRuleField,StrDictionary,matches,match,labelStr,loopStr,labelArr,lnum,ltype,lsort,lorder,ltime,whereType,whereSort,orderStr,whereTime,sql,DateArray,matchesfield,loopstrTotal,i,spec,title,contentlen,pagecontent,RsFieldSet,SqlFieldSet,Pv_Field,Pv_Fieldtitle,Pv_FieldType
		labelRule = "{wangkaicms:content([\s\S]*?)}([\s\S]*?){/wangkaicms:content}"
		labelRuleField = "\[content:([\s\S]+?)\]"
		regEx.Pattern = labelRule
		set StrDictionary=Server.CreateObject("SCRIPTING.DICTIONARY")
		set matches = regEx.Execute(HtmlContent)
		for each match in matches
		    labelStr = match.SubMatches(0)
			loopStr = match.SubMatches(1)
			set labelArr = ParseArr(labelStr)
			lnum = labelArr("num") : lchannel = labelArr("channel") : ldataname = labelArr("dataname") : ltype = labelArr("type") : lsort = labelArr("sort") : lorder = labelArr("order") : ltime = labelArr("time")
			
			if IsNul(lchannel) then lchannel=1
			
			Call GetChannel(lchannel)
			
			if IsNul(ldataname) then ldataname="Article"
			
			SqlFieldSet = "SELECT * FROM [FieldSet] WHERE ChannelID='"& lchannel &"' AND Recycle<>1 ORDER BY OrderNum ASC"
			Call Exec(RsFieldSet,SqlFieldSet,2)
			Do While Not(RsFieldSet.Eof)
				Pv_Field = Pv_Field & ",A."&RsFieldSet("Field")
				RsFieldSet.MoveNext
			Loop
			
			if IsNul(ltype) then ltype="all"
			if ltype="all" then
				whereType=""
			end if
			
			if IsNul(lnum) then lnum = 10 else lnum = cint(lnum)
			
			if IsNul(lsort) then lsort="all"
			whereSort=""
			if lsort <> "all" then
				whereSort=" and A.ClassID in ("&getSubSort(lsort, 1)&")"
			end if
			
			if IsNul(lorder) then lorder = "time"
			select case lorder           
				case "id" : orderStr =" order by A.ID desc"
				case "time" : orderStr =" order by A.Tim desc"
				case "order" : orderStr =" order by A.OrderID desc,A.ID desc,A.Tim desc"
			end select
			
			select case ltime
				case "day" : whereTime=" And DateDiff('d',A.Tim,'"&now()&"')=0"
				case "week" : whereTime=" And DateDiff('w',A.Tim,'"&now()&"')=0"
				case "month" : whereTime=" And DateDiff('m',A.Tim,'"&now()&"')=0"
				case else : whereTime=""
			end select
			
			set labelArr = nothing
			if ldataname="Article" then
				sql="select top "&lnum&" A.ID,A.ChannelID,A.SpecialID,A.ClassID,A.Inputer,A.Title,A.IncludeInfo,A.Subtitle,A.CopyFrom,A.LinkUrl,A.IsPic,A.Pic,A.UploadFiles,A.Intro,A.Content,A.Power,A.Author,A.Hits,A.Keyes,A.Tim,A.Hidden,A.Tcolor,A.HtmlFileDate,A.IsUpdate,A.PaginationType,A.MaxCharPerPage,A.IsDelete,A.Moban,A.SkinID,A.TemplateID,A.OrderID,C.ClassID,C.ChannelID,C.ClassName,C.AClassID,C.ClassOrder,C.ClassParent,C.ClassChild,C.ClassDepth,C.ClassPath,C.ClassParentStr,C.ClassChildStr,C.ClassConfig,C.ClassDir,C.HtmlFileDir,C.IsUpdate,C.Moban,C.SkinID,C.TemplateID,C.ImageWidth,C.ImageHeight,C.Columns,C.CuteNums"&Pv_Field&" From "&ldataname&" as A,Class as C where A.ClassID=C.ClassID And A.Hidden=" & WK_True & " And A.IsDelete=" & WK_False & " And A.ChannelID=" & lchannel & " "&whereType&whereSort&whereTime&orderStr
			elseif ldataname="Photo" then
				sql="select top "&lnum&" A.ID,A.ChannelID,A.SpecialID,A.ClassID,A.Inputer,A.Title,A.IncludeInfo,A.Subtitle,A.CopyFrom,A.LinkUrl,A.IsPic,A.Pic,A.UploadFiles,A.Intro,A.Content,A.Power,A.Author,A.Hits,A.Keyes,A.Tim,A.Hidden,A.Tcolor,A.HtmlFileDate,A.IsUpdate,A.PaginationType,A.MaxCharPerPage,A.IsDelete,A.Moban,A.SkinID,A.TemplateID,A.OrderID,C.ClassID,C.ChannelID,C.ClassName,C.AClassID,C.ClassOrder,C.ClassParent,C.ClassChild,C.ClassDepth,C.ClassPath,C.ClassParentStr,C.ClassChildStr,C.ClassConfig,C.ClassDir,C.HtmlFileDir,C.IsUpdate,C.Moban,C.SkinID,C.TemplateID,C.ImageWidth,C.ImageHeight,C.Columns,C.CuteNums"&Pv_Field&" From "&ldataname&" as A,Class as C where A.ClassID=C.ClassID And A.Hidden=" & WK_True & " And A.IsDelete=" & WK_False & " And A.ChannelID=" & lchannel & " "&whereType&whereSort&whereTime&orderStr
			elseif ldataname="Down" then
				sql="select top "&lnum&" A.ID,A.ChannelID,A.SpecialID,A.ClassID,A.Inputer,A.Title,A.IncludeInfo,A.Subtitle,A.CopyFrom,A.LinkUrl,A.IsPic,A.Pic,A.UploadFiles,A.Intro,A.Content,A.Power,A.Author,A.Hits,A.Keyes,A.Tim,A.SoftVersion,A.SoftType,A.SoftLanguage,A.CopyrightType,A.OperatingSystem,A.DemoUrl,A.RegUrl,A.DownloadUrl,A.DecompressPassword,A.SoftSize,A.Hidden,A.Tcolor,A.HtmlFileDate,A.IsUpdate,A.PaginationType,A.MaxCharPerPage,A.IsDelete,A.Moban,A.SkinID,A.TemplateID,A.OrderID,C.ClassID,C.ChannelID,C.ClassName,C.AClassID,C.ClassOrder,C.ClassParent,C.ClassChild,C.ClassDepth,C.ClassPath,C.ClassParentStr,C.ClassChildStr,C.ClassConfig,C.ClassDir,C.HtmlFileDir,C.IsUpdate,C.Moban,C.SkinID,C.TemplateID,C.ImageWidth,C.ImageHeight,C.Columns,C.CuteNums"&Pv_Field&" From "&ldataname&" as A,Class as C where A.ClassID=C.ClassID And A.Hidden=" & WK_True & " And A.IsDelete=" & WK_False & " And A.ChannelID=" & lchannel & " "&whereType&whereSort&whereTime&orderStr
			elseif ldataname="Shop" then
				sql="select top "&lnum&" A.ID,A.ChannelID,A.SpecialID,A.ClassID,A.Inputer,A.Title,A.IncludeInfo,A.Subtitle,A.ProductNum,A.BarCode,A.CopyFrom,A.LinkUrl,A.IsPic,A.Pic,A.UploadFiles,A.Intro,A.Content,A.Power,A.Author,A.Hits,A.Keyes,A.Tim,A.Unit,A.ProductModel,A.ProductStandard,A.ProducerName,A.TrademarkName,A.ProductType,A.Price,A.Price_Original,A.Price_Market,A.Price_Member,A.EnableWholesale,A.Price_Wholesale1,A.Number_Wholesale1,A.Price_Wholesale2,A.Number_Wholesale2,A.Price_Wholesale3,A.Number_Wholesale3,A.Price_Agent,A.Stocks,A.OrderNum,A.AlarmNum,A.EnableSale,A.Discount,A.BeginDate,A.EndDate,A.BuyTimes,A.SalePromotionType,A.MinNumber,A.PresentNumber,A.PresentID,A.PresentMoney,A.PresentPoint,A.PresentExp,A.Weight,A.EnableSingleSell,A.DependentProducts,A.LimitNum,A.Hidden,A.Tcolor,A.HtmlFileDate,A.IsUpdate,A.PaginationType,A.MaxCharPerPage,A.IsDelete,A.Moban,A.SkinID,A.TemplateID,A.OrderID,C.ClassID,C.ChannelID,C.ClassName,C.AClassID,C.ClassOrder,C.ClassParent,C.ClassChild,C.ClassDepth,C.ClassPath,C.ClassParentStr,C.ClassChildStr,C.ClassConfig,C.ClassDir,C.HtmlFileDir,C.IsUpdate,C.Moban,C.SkinID,C.TemplateID,C.ImageWidth,C.ImageHeight,C.Columns,C.CuteNums"&Pv_Field&" From "&ldataname&" as A,Class as C where A.ClassID=C.ClassID And A.Hidden=" & WK_True & " And A.IsDelete=" & WK_False & " And A.ChannelID=" & lchannel & " "&whereType&whereSort&whereTime&orderStr
			elseif ldataname="GuestBook" then
				sql="select FaqID,FaqTitle,Contact,ContactWay,Content,Reply,AddTime,ReplyTime,FaqStatus,AuditStatus from GuestBook where FaqStatus order by AddTime"
			else
				sql="select top "&lnum&" A.ID,A.ChannelID,A.SpecialID,A.ClassID,A.Inputer,A.Title,A.IncludeInfo,A.Subtitle,A.CopyFrom,A.LinkUrl,A.IsPic,A.Pic,A.UploadFiles,A.Intro,A.Content,A.Power,A.Author,A.Hits,A.Keyes,A.Tim,A.Hidden,A.Tcolor,A.HtmlFileDate,A.IsUpdate,A.PaginationType,A.MaxCharPerPage,A.IsDelete,A.Moban,A.SkinID,A.TemplateID,A.OrderID,C.ClassID,C.ChannelID,C.ClassName,C.AClassID,C.ClassOrder,C.ClassParent,C.ClassChild,C.ClassDepth,C.ClassPath,C.ClassParentStr,C.ClassChildStr,C.ClassConfig,C.ClassDir,C.HtmlFileDir,C.IsUpdate,C.Moban,C.SkinID,C.TemplateID,C.ImageWidth,C.ImageHeight,C.Columns,C.CuteNums"&Pv_Field&" From "&ldataname&" as A,Class as C where A.ClassID=C.ClassID And A.Hidden=" & WK_True & " And A.IsDelete=" & WK_False & " And A.ChannelID=" & lchannel & " "&whereType&whereSort&whereTime&orderStr
			end if
			
			fetchCount=lnum
			Call Exe_Conn(DateArray,sql,1)
			if not DateArray.eof then
				if fetchCount=0 then DateArray = DateArray.GetRows() else DateArray = DateArray.GetRows(fetchCount)
			end if
			dim rsObj
			Call Exe_Conn(rsObj,sql,1)
			fetchCount=0
			regEx.Pattern = labelRuleField
			set matchesfield = regEx.Execute(loopStr)
			loopstrTotal = ""
			if isArray(DateArray) then lnum = ubound(DateArray,2) else lnum=-1
			dim nloopstr,matchfield,fieldNameArr,m,fieldName,fieldArr,infolen,namelen,timestyle
			
			for i = 0 to lnum
			    nloopstr=loopStr
			    for each matchfield in matchesfield
					fieldNameArr = RegExpReplace(matchfield.SubMatches(0),"[\s]+",chr(32))
					fieldNameArr = trim(fieldNameArr)
					m = instr(fieldNameArr,chr(32))
					if  m > 0 then
						fieldName = left(fieldNameArr,m - 1)
						fieldArr = right(fieldNameArr,len(fieldNameArr) - m)
					else
						fieldName = fieldNameArr
						fieldArr = ""
					end if
					
					if ldataname="Article" then
						select case fieldName
							case "i"
								nloopstr = replace(nloopstr,matchfield.value,i+1)
							case "link"
								'跳转链接
								if DateArray(9,i)<>"" then
									nloopstr = replace(nloopstr,matchfield.value,DateArray(9,i))
								else
									If ChannelIsCreateHtml = True Then
										nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/" & rsObj("HtmlFileDir") & ShowDatePath(rsObj("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(rsObj("HtmlFileDate"), rsObj("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, ""))
									Else
										nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/View.asp?id=" & rsObj("ID"))
									End If
								end if
							case "title"
								namelen = ParseArr(fieldArr)("len")
								title=DateArray(5,i)
								if not IsNul(namelen) then
									namelen=cint(namelen)
									if len(DateArray(5,i))>namelen then title=left(DateArray(5,i),namelen)&"..."
								end if
								nloopstr = replace(nloopstr,matchfield.value,title)
							case "content"
								contentlen = ParseArr(fieldArr)("len")
								pagecontent=rsObj("Content")
								if not IsNul(contentlen) then
									contentlen=cint(contentlen)
									if len(pagecontent)>contentlen then pagecontent=left(pagecontent,contentlen)&"..."
								end if
								nloopstr = replace(nloopstr,matchfield.value,pagecontent)
							case "titlecolor"
								if DateArray(21,i)<>"" then
									nloopstr = replace(nloopstr,matchfield.value,DateArray(21,i))
								else
									nloopstr = replace(nloopstr,matchfield.value,"")
								end if
							case "classname"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("ClassName"))
							case "classlink"
								If ChannelIsCreateHtml = True Then
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/" & rsObj("HtmlFileDir") & "Index" & ChannelHtmlExtName)
								Else
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/List.asp?ClassID=" & DateArray(31,i))
								End If
							case "date"
								timestyle = ParseArr(fieldArr)("style") : if IsNul(timestyle) then timestyle = "m-d"
								select case timestyle
									case "yy-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),1))
									case "y-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),2))
									case "m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),3))
									case "yy/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),9))
									case "y/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),10))
									case "m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),11))
								end select
							case "hits"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("Hits"))
							case "author"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("Author"))
							case "copyfrom"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("CopyFrom"))
							case "ispic" '是否图片
								nloopstr = replace(nloopstr,matchfield.value,rsObj("IsPic"))
							case "desc"
								if not IsNul(rsObj("Intro")) then
									infolen = ParseArr(fieldArr)("len") : if IsNul(infolen) then infolen = 200 else infolen=cint(infolen)
									nloopstr = replace(nloopstr,matchfield.value,left(FilterStr(replace(rsObj("Intro"),"[NextPage]",""),"html"),infolen))
								else
									infolen = ParseArr(fieldArr)("len") : if IsNul(infolen) then infolen = 200 else infolen=cint(infolen)
									nloopstr = replace(nloopstr,matchfield.value,left(FilterStr(replace(rsObj("Content"),"[NextPage]",""),"html"),infolen))
								end if
							case "pic"
								if not IsNul(rsObj("Pic")) then 
									if instr(rsObj("Pic"),"http://")>0 then 
										nloopstr = replace(nloopstr,matchfield.value,rsObj("Pic"))
									else
										nloopstr = replace(nloopstr,matchfield.value,Replace(rsObj("Pic"),"{$download_dir}", InstallDir&UploadSetting(1)))
									end if
								else
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & "Images/no_pic.png")
								end if
							case fieldName
								SqlFieldSet = "SELECT * FROM [FieldSet] WHERE Field='"& fieldName &"' AND ChannelID='"& lchannel &"' AND Recycle<>1 ORDER BY OrderNum ASC"
								Call Exec(RsFieldSet,SqlFieldSet,2)
								If RsFieldSet.BOF And RsFieldSet.EOF Then
									RsFieldSet.Close
									Set RsFieldSet = Nothing
									nloopstr = replace(nloopstr,matchfield.value,"")
								Else
									Pv_FieldType = RsFieldSet("FieldType")
									RsFieldSet.Close
									Set RsFieldSet = Nothing
									if not IsNul(Pv_Field) then
										namelen = ParseArr(fieldArr)("len")
										Pv_Fieldtitle=rsObj(fieldName)
									end if
									if not IsNul(Pv_Fieldtitle) then
										If Pv_FieldType="checkbox" Then
											nloopstr = replace(nloopstr,matchfield.value,left(Pv_Fieldtitle,len(Pv_Fieldtitle)-1))
										Else
											if not IsNul(namelen) then
												namelen=cint(namelen)
												if len(rsObj(fieldName))>namelen then Pv_Fieldtitle=left(rsObj(fieldName),namelen)&"..."
											end if
											nloopstr = replace(nloopstr,matchfield.value,Pv_Fieldtitle)
										End If
									else
										nloopstr = replace(nloopstr,matchfield.value,"")
									end if
								End If
						end select
					elseif ldataname="Photo" then
						select case fieldName
							case "i"
								nloopstr = replace(nloopstr,matchfield.value,i+1)
							case "link"
								'跳转链接
								if DateArray(9,i)<>"" then
									nloopstr = replace(nloopstr,matchfield.value,DateArray(9,i))
								else
									If ChannelIsCreateHtml = True Then
										nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/" & rsObj("HtmlFileDir") & ShowDatePath(rsObj("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(rsObj("HtmlFileDate"), rsObj("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, ""))
									Else
										nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/View.asp?id=" & rsObj("ID"))
									End If
								end if
							case "title"
								namelen = ParseArr(fieldArr)("len")
								title=DateArray(5,i)
								if not IsNul(namelen) then
									namelen=cint(namelen)
									if len(DateArray(5,i))>namelen then title=left(DateArray(5,i),namelen)&"..."
								end if
								nloopstr = replace(nloopstr,matchfield.value,title)
							case "content"
								contentlen = ParseArr(fieldArr)("len")
								pagecontent=rsObj("Content")
								if not IsNul(contentlen) then
									contentlen=cint(contentlen)
									if len(pagecontent)>contentlen then pagecontent=left(pagecontent,contentlen)&"..."
								end if
								nloopstr = replace(nloopstr,matchfield.value,pagecontent)
							case "titlecolor"
								if DateArray(21,i)<>"" then
									nloopstr = replace(nloopstr,matchfield.value,DateArray(21,i))
								else
									nloopstr = replace(nloopstr,matchfield.value,"")
								end if
							case "classname"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("ClassName"))
							case "classlink"
								If ChannelIsCreateHtml = True Then
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/" & rsObj("HtmlFileDir") & "Index" & ChannelHtmlExtName)
								Else
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/List.asp?ClassID=" & DateArray(31,i))
								End If
							case "date"
								timestyle = ParseArr(fieldArr)("style") : if IsNul(timestyle) then timestyle = "m-d"
								select case timestyle
									case "yy-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),1))
									case "y-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),2))
									case "m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),3))
									case "yy/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),9))
									case "y/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),10))
									case "m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),11))
								end select
							case "hits"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("Hits"))
							case "author"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("Author"))
							case "copyfrom"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("CopyFrom"))
							case "ispic" '是否图片
								nloopstr = replace(nloopstr,matchfield.value,rsObj("IsPic"))
							case "desc"
								if not IsNul(rsObj("Intro")) then
									infolen = ParseArr(fieldArr)("len") : if IsNul(infolen) then infolen = 200 else infolen=cint(infolen)
									nloopstr = replace(nloopstr,matchfield.value,left(FilterStr(replace(rsObj("Intro"),"[NextPage]",""),"html"),infolen))
								else
									infolen = ParseArr(fieldArr)("len") : if IsNul(infolen) then infolen = 200 else infolen=cint(infolen)
									nloopstr = replace(nloopstr,matchfield.value,left(FilterStr(replace(rsObj("Content"),"[NextPage]",""),"html"),infolen))
								end if
							case "pic"
								if not IsNul(rsObj("Pic")) then 
									if instr(rsObj("Pic"),"http://")>0 then 
										nloopstr = replace(nloopstr,matchfield.value,rsObj("Pic"))
									else
										nloopstr = replace(nloopstr,matchfield.value,Replace(rsObj("Pic"),"{$download_dir}", InstallDir&UploadSetting(1)))
									end if
								else
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & "Images/no_pic.png")
								end if
							case fieldName
								SqlFieldSet = "SELECT * FROM [FieldSet] WHERE Field='"& fieldName &"' AND ChannelID='"& lchannel &"' AND Recycle<>1 ORDER BY OrderNum ASC"
								Call Exec(RsFieldSet,SqlFieldSet,2)
								If RsFieldSet.BOF And RsFieldSet.EOF Then
									RsFieldSet.Close
									Set RsFieldSet = Nothing
									nloopstr = replace(nloopstr,matchfield.value,"")
								Else
									Pv_FieldType = RsFieldSet("FieldType")
									RsFieldSet.Close
									Set RsFieldSet = Nothing
									if not IsNul(Pv_Field) then
										namelen = ParseArr(fieldArr)("len")
										Pv_Fieldtitle=rsObj(fieldName)
									end if
									if not IsNul(Pv_Fieldtitle) then
										If Pv_FieldType="checkbox" Then
											nloopstr = replace(nloopstr,matchfield.value,left(Pv_Fieldtitle,len(Pv_Fieldtitle)-1))
										Else
											if not IsNul(namelen) then
												namelen=cint(namelen)
												if len(rsObj(fieldName))>namelen then Pv_Fieldtitle=left(rsObj(fieldName),namelen)&"..."
											end if
											nloopstr = replace(nloopstr,matchfield.value,Pv_Fieldtitle)
										End If
									else
										nloopstr = replace(nloopstr,matchfield.value,"")
									end if
								End If
						end select
					elseif ldataname="Down" then
						select case fieldName
							case "i"
								nloopstr = replace(nloopstr,matchfield.value,i+1)
							case "link"
								'跳转链接
								if DateArray(9,i)<>"" then
									nloopstr = replace(nloopstr,matchfield.value,DateArray(9,i))
								else
									If ChannelIsCreateHtml = True Then
										nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/" & rsObj("HtmlFileDir") & ShowDatePath(rsObj("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(rsObj("HtmlFileDate"), rsObj("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, ""))
									Else
										nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/View.asp?id=" & rsObj("ID"))
									End If
								end if
							case "title"
								namelen = ParseArr(fieldArr)("len")
								title=DateArray(5,i)
								if not IsNul(namelen) then
									namelen=cint(namelen)
									if len(DateArray(5,i))>namelen then title=left(DateArray(5,i),namelen)&"..."
								end if
								nloopstr = replace(nloopstr,matchfield.value,title)
							case "content"
								contentlen = ParseArr(fieldArr)("len")
								pagecontent=rsObj("Content")
								if not IsNul(contentlen) then
									contentlen=cint(contentlen)
									if len(pagecontent)>contentlen then pagecontent=left(pagecontent,contentlen)&"..."
								end if
								nloopstr = replace(nloopstr,matchfield.value,pagecontent)
							case "titlecolor"
								if DateArray(21,i)<>"" then
									nloopstr = replace(nloopstr,matchfield.value,DateArray(21,i))
								else
									nloopstr = replace(nloopstr,matchfield.value,"")
								end if
							case "classname"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("ClassName"))
							case "classlink"
								If ChannelIsCreateHtml = True Then
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/" & rsObj("HtmlFileDir") & "Index" & ChannelHtmlExtName)
								Else
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/List.asp?ClassID=" & DateArray(31,i))
								End If
							case "date"
								timestyle = ParseArr(fieldArr)("style") : if IsNul(timestyle) then timestyle = "m-d"
								select case timestyle
									case "yy-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),1))
									case "y-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),2))
									case "m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),3))
									case "yy/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),9))
									case "y/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),10))
									case "m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),11))
								end select
							case "hits"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("Hits"))
							case "dayhits"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("DayHits"))
							case "weekhits"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("WeekHits"))
							case "monthhits"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("MonthHits"))
							case "downhits"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("DownHits"))
							case "softversion"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("SoftVersion"))
							case "softsize"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("SoftSize"))
							case "softsizem"
								nloopstr = replace(nloopstr,matchfield.value,Round(rsObj("SoftSize") / 1024, 2))
							case "copyrighttype"
								nloopstr = replace(nloopstr,matchfield.value,WK_HTMLEncode(rsObj("CopyrightType")))
							case "operatingsystem"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("OperatingSystem"))
							case "softtype"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("SoftType"))
							case "softlanguage"
								nloopstr = replace(nloopstr,matchfield.value,WK_HTMLEncode(rsObj("SoftLanguage")))
							case "demourl"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("DemoUrl"))
							case "regurl"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("RegUrl"))
							case "decompresspassword"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("DecompressPassword"))
							case "author"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("Author"))
							case "copyfrom"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("CopyFrom"))
							case "ispic" '是否图片
								nloopstr = replace(nloopstr,matchfield.value,rsObj("IsPic"))
							case "desc"
								if not IsNul(rsObj("Intro")) then
									infolen = ParseArr(fieldArr)("len") : if IsNul(infolen) then infolen = 200 else infolen=cint(infolen)
									nloopstr = replace(nloopstr,matchfield.value,left(FilterStr(replace(rsObj("Intro"),"[NextPage]",""),"html"),infolen))
								else
									infolen = ParseArr(fieldArr)("len") : if IsNul(infolen) then infolen = 200 else infolen=cint(infolen)
									nloopstr = replace(nloopstr,matchfield.value,left(FilterStr(replace(rsObj("Content"),"[NextPage]",""),"html"),infolen))
								end if
							case "pic"
								if not IsNul(rsObj("Pic")) then 
									if instr(rsObj("Pic"),"http://")>0 then 
										nloopstr = replace(nloopstr,matchfield.value,rsObj("Pic"))
									else
										nloopstr = replace(nloopstr,matchfield.value,Replace(rsObj("Pic"),"{$download_dir}", InstallDir&UploadSetting(1)))
									end if
								else
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & "Images/no_pic.png")
								end if
							case fieldName
								SqlFieldSet = "SELECT * FROM [FieldSet] WHERE Field='"& fieldName &"' AND ChannelID='"& lchannel &"' AND Recycle<>1 ORDER BY OrderNum ASC"
								Call Exec(RsFieldSet,SqlFieldSet,2)
								If RsFieldSet.BOF And RsFieldSet.EOF Then
									RsFieldSet.Close
									Set RsFieldSet = Nothing
									nloopstr = replace(nloopstr,matchfield.value,"")
								Else
									Pv_FieldType = RsFieldSet("FieldType")
									RsFieldSet.Close
									Set RsFieldSet = Nothing
									if not IsNul(Pv_Field) then
										namelen = ParseArr(fieldArr)("len")
										Pv_Fieldtitle=rsObj(fieldName)
									end if
									if not IsNul(Pv_Fieldtitle) then
										If Pv_FieldType="checkbox" Then
											nloopstr = replace(nloopstr,matchfield.value,left(Pv_Fieldtitle,len(Pv_Fieldtitle)-1))
										Else
											if not IsNul(namelen) then
												namelen=cint(namelen)
												if len(rsObj(fieldName))>namelen then Pv_Fieldtitle=left(rsObj(fieldName),namelen)&"..."
											end if
											nloopstr = replace(nloopstr,matchfield.value,Pv_Fieldtitle)
										End If
									else
										nloopstr = replace(nloopstr,matchfield.value,"")
									end if
								End If
						end select
					elseif ldataname="Shop" then
						select case fieldName
							case "i"
								nloopstr = replace(nloopstr,matchfield.value,i+1)
							case "link"
								'跳转链接
								if DateArray(9,i)<>"" then
									nloopstr = replace(nloopstr,matchfield.value,DateArray(9,i))
								else
									If ChannelIsCreateHtml = True Then
										nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/" & rsObj("HtmlFileDir") & ShowDatePath(rsObj("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(rsObj("HtmlFileDate"), rsObj("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, ""))
									Else
										nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/View.asp?id=" & rsObj("ID"))
									End If
								end if
							case "title"
								namelen = ParseArr(fieldArr)("len")
								title=DateArray(5,i)
								if not IsNul(namelen) then
									namelen=cint(namelen)
									if len(DateArray(5,i))>namelen then title=left(DateArray(5,i),namelen)&"..."
								end if
								nloopstr = replace(nloopstr,matchfield.value,title)
							case "content"
								contentlen = ParseArr(fieldArr)("len")
								pagecontent=rsObj("Content")
								if not IsNul(contentlen) then
									contentlen=cint(contentlen)
									if len(pagecontent)>contentlen then pagecontent=left(pagecontent,contentlen)&"..."
								end if
								nloopstr = replace(nloopstr,matchfield.value,pagecontent)
							case "titlecolor"
								if DateArray(21,i)<>"" then
									nloopstr = replace(nloopstr,matchfield.value,DateArray(21,i))
								else
									nloopstr = replace(nloopstr,matchfield.value,"")
								end if
							case "classname"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("ClassName"))
							case "classlink"
								If ChannelIsCreateHtml = True Then
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/" & rsObj("HtmlFileDir") & "Index" & ChannelHtmlExtName)
								Else
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/List.asp?ClassID=" & DateArray(31,i))
								End If
							case "date"
								timestyle = ParseArr(fieldArr)("style") : if IsNul(timestyle) then timestyle = "m-d"
								select case timestyle
									case "yy-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),1))
									case "y-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),2))
									case "m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),3))
									case "yy/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),9))
									case "y/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),10))
									case "m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),11))
								end select
							case "hits"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("Hits"))
							case "author"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("Author"))
							case "copyfrom"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("CopyFrom"))
							case "ispic" '是否图片
								nloopstr = replace(nloopstr,matchfield.value,rsObj("IsPic"))
							case "desc"
								if not IsNul(rsObj("Intro")) then
									infolen = ParseArr(fieldArr)("len") : if IsNul(infolen) then infolen = 200 else infolen=cint(infolen)
									nloopstr = replace(nloopstr,matchfield.value,left(FilterStr(replace(rsObj("Intro"),"[NextPage]",""),"html"),infolen))
								else
									infolen = ParseArr(fieldArr)("len") : if IsNul(infolen) then infolen = 200 else infolen=cint(infolen)
									nloopstr = replace(nloopstr,matchfield.value,left(FilterStr(replace(rsObj("Content"),"[NextPage]",""),"html"),infolen))
								end if
							case "pic"
								if not IsNul(rsObj("Pic")) then
									if instr(rsObj("Pic"),"http://")>0 then
										nloopstr = replace(nloopstr,matchfield.value,rsObj("Pic"))
									else
										nloopstr = replace(nloopstr,matchfield.value,Replace(rsObj("Pic"),"{$download_dir}", InstallDir&UploadSetting(1)))
									end if
								else
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & "Images/no_pic.png")
								end if
							case fieldName
								SqlFieldSet = "SELECT * FROM [FieldSet] WHERE Field='"& fieldName &"' AND ChannelID='"& lchannel &"' AND Recycle<>1 ORDER BY OrderNum ASC"
								Call Exec(RsFieldSet,SqlFieldSet,2)
								If RsFieldSet.BOF And RsFieldSet.EOF Then
									RsFieldSet.Close
									Set RsFieldSet = Nothing
									nloopstr = replace(nloopstr,matchfield.value,"")
								Else
									Pv_FieldType = RsFieldSet("FieldType")
									RsFieldSet.Close
									Set RsFieldSet = Nothing
									if not IsNul(Pv_Field) then
										namelen = ParseArr(fieldArr)("len")
										Pv_Fieldtitle=rsObj(fieldName)
									end if
									if not IsNul(Pv_Fieldtitle) then
										If Pv_FieldType="checkbox" Then
											nloopstr = replace(nloopstr,matchfield.value,left(Pv_Fieldtitle,len(Pv_Fieldtitle)-1))
										Else
											if not IsNul(namelen) then
												namelen=cint(namelen)
												if len(rsObj(fieldName))>namelen then Pv_Fieldtitle=left(rsObj(fieldName),namelen)&"..."
											end if
											nloopstr = replace(nloopstr,matchfield.value,Pv_Fieldtitle)
										End If
									else
										nloopstr = replace(nloopstr,matchfield.value,"")
									end if
								End If
						end select
					elseif ldataname="GuestBook" then
						select case fieldName
							case "i"
								nloopstr = replace(nloopstr,matchfield.value,i+1)
							case "link"
								'if rsObj(5)=1 then nloopstr = replace(nloopstr,matchfield.value,rsObj(9)) : else nloopstr = replace(nloopstr,matchfield.value,getContentLink(DateArray(0,i),DateArray(0,i),showType))
							case "title"
								namelen = ParseArr(fieldArr)("len")
								title=filterDirty(DateArray(1,i))
								if not IsNul(namelen) then
									namelen=cint(namelen)
									if len(title)>namelen then title=left(title,namelen)&"..."
								end if
								nloopstr = replace(nloopstr,matchfield.value,title)
							case "name"
								nloopstr = replace(nloopstr,matchfield.value,repNull(DateArray(2,i)))
							case "status"
								nloopstr = replace(nloopstr,matchfield.value,DateArray(8,i))
							case "winfo"
								nloopstr = replace(nloopstr,matchfield.value,filterDirty(repNull(DateArray(4,i))))
							case "rinfo"
								nloopstr = replace(nloopstr,matchfield.value,repNull(DateArray(5,i)))
							case "wdate"
								timestyle = ParseArr(fieldArr)("style") : if IsNul(timestyle) then timestyle = "m-d"
								select case timestyle
									case "yy-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(DateArray(6,i),1))
									case "y-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(DateArray(6,i),2))
									case "m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(DateArray(6,i),3))
									case "yy/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(DateArray(6,i),9))
									case "y/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(DateArray(6,i),10))
									case "m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(DateArray(6,i),11))
								end select
							case "rdate"
								timestyle = ParseArr(fieldArr)("style") : if IsNul(timestyle) then timestyle = "m-d"
								select case timestyle
									case "yy-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(DateArray(7,i),1))
									case "y-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(DateArray(7,i),2))
									case "m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(DateArray(7,i),3))
									case "yy/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(DateArray(7,i),9))
									case "y/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(DateArray(7,i),10))
									case "m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(DateArray(7,i),11))
								end select
						end select
					else
						select case fieldName
							case "i"
								nloopstr = replace(nloopstr,matchfield.value,i+1)
							case "link"
								'跳转链接
								if DateArray(9,i)<>"" then
									nloopstr = replace(nloopstr,matchfield.value,DateArray(9,i))
								else
									If ChannelIsCreateHtml = True Then
										nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/" & rsObj("HtmlFileDir") & ShowDatePath(rsObj("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(rsObj("HtmlFileDate"), rsObj("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, ""))
									Else
										nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/View.asp?id=" & rsObj("ID"))
									End If
								end if
							case "title"
								namelen = ParseArr(fieldArr)("len")
								title=DateArray(5,i)
								if not IsNul(namelen) then
									namelen=cint(namelen)
									if len(DateArray(5,i))>namelen then title=left(DateArray(5,i),namelen)&"..."
								end if
								nloopstr = replace(nloopstr,matchfield.value,title)
							case "content"
								contentlen = ParseArr(fieldArr)("len")
								pagecontent=rsObj("Content")
								if not IsNul(contentlen) then
									contentlen=cint(contentlen)
									if len(pagecontent)>contentlen then pagecontent=left(pagecontent,contentlen)&"..."
								end if
								nloopstr = replace(nloopstr,matchfield.value,pagecontent)
							case "titlecolor"
								if DateArray(21,i)<>"" then
									nloopstr = replace(nloopstr,matchfield.value,DateArray(21,i))
								else
									nloopstr = replace(nloopstr,matchfield.value,"")
								end if
							case "classname"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("ClassName"))
							case "classlink"
								If ChannelIsCreateHtml = True Then
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/" & rsObj("HtmlFileDir") & "Index" & ChannelHtmlExtName)
								Else
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/List.asp?ClassID=" & DateArray(31,i))
								End If
							case "date"
								timestyle = ParseArr(fieldArr)("style") : if IsNul(timestyle) then timestyle = "m-d"
								select case timestyle
									case "yy-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),1))
									case "y-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),2))
									case "m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),3))
									case "yy/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),9))
									case "y/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),10))
									case "m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),11))
								end select
							case "hits"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("Hits"))
							case "author"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("Author"))
							case "copyfrom"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("CopyFrom"))
							case "ispic" '是否图片
								nloopstr = replace(nloopstr,matchfield.value,rsObj("IsPic"))
							case "desc"
								if not IsNul(rsObj("Intro")) then
									infolen = ParseArr(fieldArr)("len") : if IsNul(infolen) then infolen = 200 else infolen=cint(infolen)
									nloopstr = replace(nloopstr,matchfield.value,left(FilterStr(replace(rsObj("Intro"),"[NextPage]",""),"html"),infolen))
								else
									infolen = ParseArr(fieldArr)("len") : if IsNul(infolen) then infolen = 200 else infolen=cint(infolen)
									nloopstr = replace(nloopstr,matchfield.value,left(FilterStr(replace(rsObj("Content"),"[NextPage]",""),"html"),infolen))
								end if
							case "pic"
								if not IsNul(rsObj("Pic")) then 
									if instr(rsObj("Pic"),"http://")>0 then 
										nloopstr = replace(nloopstr,matchfield.value,rsObj("Pic"))
									else
										nloopstr = replace(nloopstr,matchfield.value,Replace(rsObj("Pic"),"{$download_dir}", InstallDir&UploadSetting(1)))
									end if
								else
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & "Images/no_pic.png")
								end if
							case fieldName
								SqlFieldSet = "SELECT * FROM [FieldSet] WHERE Field='"& fieldName &"' AND ChannelID='"& lchannel &"' AND Recycle<>1 ORDER BY OrderNum ASC"
								Call Exec(RsFieldSet,SqlFieldSet,2)
								If RsFieldSet.BOF And RsFieldSet.EOF Then
									RsFieldSet.Close
									Set RsFieldSet = Nothing
									nloopstr = replace(nloopstr,matchfield.value,"")
								Else
									Pv_FieldType = RsFieldSet("FieldType")
									RsFieldSet.Close
									Set RsFieldSet = Nothing
									if not IsNul(Pv_Field) then
										namelen = ParseArr(fieldArr)("len")
										Pv_Fieldtitle=rsObj(fieldName)
									end if
									if not IsNul(Pv_Fieldtitle) then
										If Pv_FieldType="checkbox" Then
											nloopstr = replace(nloopstr,matchfield.value,left(Pv_Fieldtitle,len(Pv_Fieldtitle)-1))
										Else
											if not IsNul(namelen) then
												namelen=cint(namelen)
												if len(rsObj(fieldName))>namelen then Pv_Fieldtitle=left(rsObj(fieldName),namelen)&"..."
											end if
											nloopstr = replace(nloopstr,matchfield.value,Pv_Fieldtitle)
										End If
									else
										nloopstr = replace(nloopstr,matchfield.value,"")
									end if
								End If
						end select
					end if
				next
				loopstrTotal = loopstrTotal & nloopstr
			rsObj.movenext
			next
			set matchesfield = nothing
			HtmlContent = replace(HtmlContent,match.value,loopstrTotal)
			StrDictionary.removeAll
		next
		set matches = nothing
		set StrDictionary=nothing
	End Function
	
	'替换List循环标签
	Public Function parseList(typeIds,currentPage,keys)	
		dim lenPagelist,TypeId,strPagelist,lsize,rsObj,labelRule,labelRuleField,labelRulePagelist,StrDictionary,matches,match,labelStr,loopStr,labelArr,lorder,orderStr,sql,matchesfield,sperStrs,spec,sperStr,title,ldataname,RsFieldSet,SqlFieldSet,Pv_Field,Pv_Fieldtitle,Pv_FieldType
		labelRule = "{wangkaicms:list([\s\S]*?)}([\s\S]*?){/wangkaicms:list}"
		labelRuleField = "\[list:([\s\S]+?)\]"
		labelRulePagelist = "\[list:pagenumber([\s\S]*?)\]"
		regEx.Pattern = labelRule
		set StrDictionary=Server.CreateObject("SCRIPTING.DICTIONARY")
		set matches = regEx.Execute(HtmlContent)
		
		if IsNul(ChannelID) then ChannelID=1
			
		Call GetChannel(ChannelID)
		ldataname = ChannelDataName
		
		if IsNul(ldataname) then ldataname="Article"
		
		SqlFieldSet = "SELECT * FROM [FieldSet] WHERE ChannelID="& ChannelID &" AND Recycle<>1 ORDER BY OrderNum ASC"
		Call Exec(RsFieldSet,SqlFieldSet,2)
		Do While Not(RsFieldSet.Eof)
			Pv_Field = Pv_Field & ",A."&RsFieldSet("Field")
			RsFieldSet.MoveNext
		Loop
		
		for each match in matches
			labelStr = match.SubMatches(0)
			loopStr = match.SubMatches(1)
			set labelArr = parseArr(labelStr)
			lsize = cint(labelArr("size")) : lorder = labelArr("order")
			if IsNul(typeIds) then typeIds = Code_CLng(labelArr("sort"))
			if IsNul(lsize) then lsize = 12 
			if IsNul(lorder) then lorder = "time"
			select case lorder
				case "id" : orderStr =" order by A.ID desc"
				case "hits" : orderStr =" order by A.Hits desc"
				case "time" : orderStr =" order by A.Tim desc"
				case "order" : orderStr =" order by A.OrderID desc,A.ID desc,A.Tim desc"
			end select
			
			set labelArr = nothing
			if IsNul(keys) then					
				keysStr = ""
			else'搜索
				if Field="" then Field="Title"
				keysStr = " and "&Field&" like '%"&keys&"%'"
			end if
			if ldataname="Article" then
				sql="select A.ID,A.ChannelID,A.SpecialID,A.ClassID,A.Inputer,A.Title,A.IncludeInfo,A.Subtitle,A.CopyFrom,A.LinkUrl,A.IsPic,A.Pic,A.UploadFiles,A.Intro,A.Content,A.Power,A.Author,A.Hits,A.Keyes,A.Tim,A.Hidden,A.Tcolor,A.HtmlFileDate,A.IsUpdate,A.PaginationType,A.MaxCharPerPage,A.IsDelete,A.Moban,A.SkinID,A.TemplateID,A.OrderID,C.ClassID,C.ChannelID,C.ClassName,C.AClassID,C.ClassOrder,C.ClassParent,C.ClassChild,C.ClassDepth,C.ClassPath,C.ClassParentStr,C.ClassChildStr,C.ClassConfig,C.ClassDir,C.HtmlFileDir,C.IsUpdate,C.Moban,C.SkinID,C.TemplateID,C.ImageWidth,C.ImageHeight,C.Columns,C.CuteNums"&Pv_Field&" From "&ldataname&" as A,Class as C where A.ClassID=C.ClassID And A.Hidden=" & WK_True & " And A.IsDelete=" & WK_False & " And A.ChannelID=" & ChannelID & " And A.ClassID in ("&getSubSort(typeIds, 1)&")"&keysStr&orderStr
			elseif ldataname="Photo" then
				sql="select A.ID,A.ChannelID,A.SpecialID,A.ClassID,A.Inputer,A.Title,A.IncludeInfo,A.Subtitle,A.CopyFrom,A.LinkUrl,A.IsPic,A.Pic,A.UploadFiles,A.Intro,A.Content,A.Power,A.Author,A.Hits,A.Keyes,A.Tim,A.Hidden,A.Tcolor,A.HtmlFileDate,A.IsUpdate,A.PaginationType,A.MaxCharPerPage,A.IsDelete,A.Moban,A.SkinID,A.TemplateID,A.OrderID,C.ClassID,C.ChannelID,C.ClassName,C.AClassID,C.ClassOrder,C.ClassParent,C.ClassChild,C.ClassDepth,C.ClassPath,C.ClassParentStr,C.ClassChildStr,C.ClassConfig,C.ClassDir,C.HtmlFileDir,C.IsUpdate,C.Moban,C.SkinID,C.TemplateID,C.ImageWidth,C.ImageHeight,C.Columns,C.CuteNums"&Pv_Field&" From "&ldataname&" as A,Class as C where A.ClassID=C.ClassID And A.Hidden=" & WK_True & " And A.IsDelete=" & WK_False & " And A.ChannelID=" & ChannelID & " And A.ClassID in ("&getSubSort(typeIds, 1)&")"&keysStr&orderStr
			elseif ldataname="Down" then
				sql="select A.ID,A.ChannelID,A.SpecialID,A.ClassID,A.Inputer,A.Title,A.IncludeInfo,A.Subtitle,A.CopyFrom,A.LinkUrl,A.IsPic,A.Pic,A.UploadFiles,A.Intro,A.Content,A.Power,A.Author,A.Hits,A.Keyes,A.Tim,A.SoftVersion,A.SoftType,A.SoftLanguage,A.CopyrightType,A.OperatingSystem,A.DemoUrl,A.RegUrl,A.DownloadUrl,A.DecompressPassword,A.SoftSize,A.Hidden,A.Tcolor,A.HtmlFileDate,A.IsUpdate,A.PaginationType,A.MaxCharPerPage,A.IsDelete,A.Moban,A.SkinID,A.TemplateID,A.OrderID,C.ClassID,C.ChannelID,C.ClassName,C.AClassID,C.ClassOrder,C.ClassParent,C.ClassChild,C.ClassDepth,C.ClassPath,C.ClassParentStr,C.ClassChildStr,C.ClassConfig,C.ClassDir,C.HtmlFileDir,C.IsUpdate,C.Moban,C.SkinID,C.TemplateID,C.ImageWidth,C.ImageHeight,C.Columns,C.CuteNums"&Pv_Field&" From "&ldataname&" as A,Class as C where A.ClassID=C.ClassID And A.Hidden=" & WK_True & " And A.IsDelete=" & WK_False & " And A.ChannelID=" & ChannelID & " And A.ClassID in ("&getSubSort(typeIds, 1)&")"&keysStr&orderStr
			elseif ldataname="Shop" then
				sql="select A.ID,A.ChannelID,A.SpecialID,A.ClassID,A.Inputer,A.Title,A.IncludeInfo,A.Subtitle,A.ProductNum,A.BarCode,A.CopyFrom,A.LinkUrl,A.IsPic,A.Pic,A.UploadFiles,A.Intro,A.Content,A.Power,A.Author,A.Hits,A.Keyes,A.Tim,A.Unit,A.ProductModel,A.ProductStandard,A.ProducerName,A.TrademarkName,A.ProductType,A.Price,A.Price_Original,A.Price_Market,A.Price_Member,A.EnableWholesale,A.Price_Wholesale1,A.Number_Wholesale1,A.Price_Wholesale2,A.Number_Wholesale2,A.Price_Wholesale3,A.Number_Wholesale3,A.Price_Agent,A.Stocks,A.OrderNum,A.AlarmNum,A.EnableSale,A.Discount,A.BeginDate,A.EndDate,A.BuyTimes,A.SalePromotionType,A.MinNumber,A.PresentNumber,A.PresentID,A.PresentMoney,A.PresentPoint,A.PresentExp,A.Weight,A.EnableSingleSell,A.DependentProducts,A.LimitNum,A.Hidden,A.Tcolor,A.HtmlFileDate,A.IsUpdate,A.PaginationType,A.MaxCharPerPage,A.IsDelete,A.Moban,A.SkinID,A.TemplateID,A.OrderID,C.ClassID,C.ChannelID,C.ClassName,C.AClassID,C.ClassOrder,C.ClassParent,C.ClassChild,C.ClassDepth,C.ClassPath,C.ClassParentStr,C.ClassChildStr,C.ClassConfig,C.ClassDir,C.HtmlFileDir,C.IsUpdate,C.Moban,C.SkinID,C.TemplateID,C.ImageWidth,C.ImageHeight,C.Columns,C.CuteNums"&Pv_Field&" From "&ldataname&" as A,Class as C where A.ClassID=C.ClassID And A.Hidden=" & WK_True & " And A.IsDelete=" & WK_False & " And A.ChannelID=" & ChannelID & " And A.ClassID in ("&getSubSort(typeIds, 1)&")"&keysStr&orderStr
			elseif ldataname="GuestBook" then
				sql="select FaqID,FaqTitle,Contact,ContactWay,Content,Reply,AddTime,ReplyTime,FaqStatus,AuditStatus from GuestBook where FaqStatus order by AddTime"
			else
				sql="select top A.ID,A.ChannelID,A.SpecialID,A.ClassID,A.Inputer,A.Title,A.IncludeInfo,A.Subtitle,A.CopyFrom,A.LinkUrl,A.IsPic,A.Pic,A.UploadFiles,A.Intro,A.Content,A.Power,A.Author,A.Hits,A.Keyes,A.Tim,A.Hidden,A.Tcolor,A.HtmlFileDate,A.IsUpdate,A.PaginationType,A.MaxCharPerPage,A.IsDelete,A.Moban,A.SkinID,A.TemplateID,A.OrderID,C.ClassID,C.ChannelID,C.ClassName,C.AClassID,C.ClassOrder,C.ClassParent,C.ClassChild,C.ClassDepth,C.ClassPath,C.ClassParentStr,C.ClassChildStr,C.ClassConfig,C.ClassDir,C.HtmlFileDir,C.IsUpdate,C.Moban,C.SkinID,C.TemplateID,C.ImageWidth,C.ImageHeight,C.Columns,C.CuteNums"&Pv_Field&" From "&ldataname&" as A,Class as C where A.ClassID=C.ClassID And A.Hidden=" & WK_True & " And A.IsDelete=" & WK_False & " And A.ChannelID=" & ChannelID & " And A.ClassID in ("&getSubSort(typeIds, 1)&")"&keysStr&orderStr
			end if
			
			regEx.Pattern = labelRuleField
			set matchesfield = regEx.Execute(loopStr)
			
			Call Exe_Conn(rsObj,sql,1)
			
			Dim loopstrTotal,i,nloopstr,matchfield,fieldNameArr,m,fieldName,fieldArr,namelen,infolen,timestyle,matchesPagelist,matchPagelist,contentlen,pagecontent
			if rsObj.eof then 
				if IsNul(keys) then
					loopstrTotal="对不起，该分类无任何"&ChannelTit&"！"
				else
					loopstrTotal="对不起，关键字&nbsp;<font color='red'>"&keys&"</font>&nbsp;无任何"&ChannelTit&"！"
				end if
			else
				rsObj.pagesize = lsize			
				
				if cint(currentPage)>rsObj.pagecount then currentPage=rsObj.pagecount
				'die currentPage
				rsObj.absolutepage=currentPage
				loopstrTotal = ""
				for i = 1 to lsize
					nloopstr=loopStr
					for each matchfield in matchesfield
						fieldNameArr = regExpReplace(matchfield.SubMatches(0),"[\s]+",chr(32))
						fieldNameArr = trim(fieldNameArr)
						m = instr(fieldNameArr,chr(32))
						if  m > 0 then 
							fieldName = left(fieldNameArr,m - 1)
							fieldArr =	right(fieldNameArr,len(fieldNameArr) - m)
						else
							fieldName = fieldNameArr
							fieldArr =	""
						end if
						
						if ldataname="Article" then
						select case fieldName
							case "i"
								nloopstr = replace(nloopstr,matchfield.value,i+1)
							case "link"
								'跳转链接
								if rsObj(9)<>"" then
									nloopstr = replace(nloopstr,matchfield.value,rsObj(9))
								else
									If ChannelIsCreateHtml = True Then
										nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/" & rsObj("HtmlFileDir") & ShowDatePath(rsObj("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(rsObj("HtmlFileDate"), rsObj("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, ""))
									Else
										nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/View.asp?id=" & rsObj("ID"))
									End If
								end if
							case "title"
								namelen = ParseArr(fieldArr)("len")
								title=rsObj(5)
								if not IsNul(namelen) then
									namelen=cint(namelen)
									if len(rsObj(5))>namelen then title=left(rsObj(5),namelen)&"..."
								end if
								nloopstr = replace(nloopstr,matchfield.value,title)
							case "content"
								contentlen = ParseArr(fieldArr)("len")
								pagecontent=rsObj("Content")
								if not IsNul(contentlen) then
									contentlen=cint(contentlen)
									if len(pagecontent)>contentlen then pagecontent=left(pagecontent,contentlen)&"..."
								end if
								nloopstr = replace(nloopstr,matchfield.value,pagecontent)
							case "titlecolor"
								if rsObj(21)<>"" then
									nloopstr = replace(nloopstr,matchfield.value,rsObj(21))
								else
									nloopstr = replace(nloopstr,matchfield.value,"")
								end if
							case "classname"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("ClassName"))
							case "classlink"
								If ChannelIsCreateHtml = True Then
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/" & rsObj("HtmlFileDir") & "Index" & ChannelHtmlExtName)
								Else
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/List.asp?ClassID=" & rsObj(31))
								End If
							case "date"
								timestyle = ParseArr(fieldArr)("style") : if IsNul(timestyle) then timestyle = "m-d"
								select case timestyle
									case "yy-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),1))
									case "y-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),2))
									case "m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),3))
									case "yy/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),9))
									case "y/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),10))
									case "m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),11))
								end select
							case "hits"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("Hits"))
							case "author"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("Author"))
							case "copyfrom"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("CopyFrom"))
							case "ispic" '是否图片
								nloopstr = replace(nloopstr,matchfield.value,rsObj("IsPic"))
							case "desc"
								if not IsNul(rsObj("Intro")) then
									infolen = ParseArr(fieldArr)("len") : if IsNul(infolen) then infolen = 200 else infolen=cint(infolen)
									nloopstr = replace(nloopstr,matchfield.value,left(FilterStr(replace(rsObj("Intro"),"[NextPage]",""),"html"),infolen))
								else
									infolen = ParseArr(fieldArr)("len") : if IsNul(infolen) then infolen = 200 else infolen=cint(infolen)
									nloopstr = replace(nloopstr,matchfield.value,left(FilterStr(replace(rsObj("Content"),"[NextPage]",""),"html"),infolen))
								end if
							case "pic"
								if not IsNul(rsObj("Pic")) then 
									if instr(rsObj("Pic"),"http://")>0 then 
										nloopstr = replace(nloopstr,matchfield.value,rsObj("Pic"))
									else
										nloopstr = replace(nloopstr,matchfield.value,Replace(rsObj("Pic"),"{$download_dir}", InstallDir&UploadSetting(1)))
									end if
								else
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & "Images/no_pic.png")
								end if
							case fieldName
								SqlFieldSet = "SELECT * FROM [FieldSet] WHERE Field='"& fieldName &"' AND ChannelID="& ChannelID &" AND Recycle<>1 ORDER BY OrderNum ASC"
								Call Exec(RsFieldSet,SqlFieldSet,2)
								If RsFieldSet.BOF And RsFieldSet.EOF Then
									RsFieldSet.Close
									Set RsFieldSet = Nothing
									nloopstr = replace(nloopstr,matchfield.value,"")
								Else
									Pv_FieldType = RsFieldSet("FieldType")
									RsFieldSet.Close
									Set RsFieldSet = Nothing
									if not IsNul(Pv_Field) then
										namelen = ParseArr(fieldArr)("len")
										Pv_Fieldtitle=rsObj(fieldName)
									end if
									if not IsNul(Pv_Fieldtitle) then
										If Pv_FieldType="checkbox" Then
											nloopstr = replace(nloopstr,matchfield.value,left(Pv_Fieldtitle,len(Pv_Fieldtitle)-1))
										Else
											if not IsNul(namelen) then
												namelen=cint(namelen)
												if len(rsObj(fieldName))>namelen then Pv_Fieldtitle=left(rsObj(fieldName),namelen)&"..."
											end if
											nloopstr = replace(nloopstr,matchfield.value,Pv_Fieldtitle)
										End If
									else
										nloopstr = replace(nloopstr,matchfield.value,"")
									end if
								End If
						end select
					elseif ldataname="Photo" then
						select case fieldName
							case "i"
								nloopstr = replace(nloopstr,matchfield.value,i+1)
							case "link"
								'跳转链接
								if rsObj(9)<>"" then
									nloopstr = replace(nloopstr,matchfield.value,rsObj(9))
								else
									If ChannelIsCreateHtml = True Then
										nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/" & rsObj("HtmlFileDir") & ShowDatePath(rsObj("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(rsObj("HtmlFileDate"), rsObj("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, ""))
									Else
										nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/View.asp?id=" & rsObj("ID"))
									End If
								end if
							case "title"
								namelen = ParseArr(fieldArr)("len")
								title=rsObj(5)
								if not IsNul(namelen) then
									namelen=cint(namelen)
									if len(rsObj(5))>namelen then title=left(rsObj(5),namelen)&"..."
								end if
								nloopstr = replace(nloopstr,matchfield.value,title)
							case "content"
								contentlen = ParseArr(fieldArr)("len")
								pagecontent=rsObj("Content")
								if not IsNul(contentlen) then
									contentlen=cint(contentlen)
									if len(pagecontent)>contentlen then pagecontent=left(pagecontent,contentlen)&"..."
								end if
								nloopstr = replace(nloopstr,matchfield.value,pagecontent)
							case "titlecolor"
								if rsObj(21)<>"" then
									nloopstr = replace(nloopstr,matchfield.value,rsObj(21))
								else
									nloopstr = replace(nloopstr,matchfield.value,"")
								end if
							case "classname"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("ClassName"))
							case "classlink"
								If ChannelIsCreateHtml = True Then
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/" & rsObj("HtmlFileDir") & "Index" & ChannelHtmlExtName)
								Else
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/List.asp?ClassID=" & rsObj(31))
								End If
							case "date"
								timestyle = ParseArr(fieldArr)("style") : if IsNul(timestyle) then timestyle = "m-d"
								select case timestyle
									case "yy-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),1))
									case "y-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),2))
									case "m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),3))
									case "yy/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),9))
									case "y/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),10))
									case "m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),11))
								end select
							case "hits"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("Hits"))
							case "author"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("Author"))
							case "copyfrom"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("CopyFrom"))
							case "ispic" '是否图片
								nloopstr = replace(nloopstr,matchfield.value,rsObj("IsPic"))
							case "desc"
								if not IsNul(rsObj("Intro")) then
									infolen = ParseArr(fieldArr)("len") : if IsNul(infolen) then infolen = 200 else infolen=cint(infolen)
									nloopstr = replace(nloopstr,matchfield.value,left(FilterStr(replace(rsObj("Intro"),"[NextPage]",""),"html"),infolen))
								else
									infolen = ParseArr(fieldArr)("len") : if IsNul(infolen) then infolen = 200 else infolen=cint(infolen)
									nloopstr = replace(nloopstr,matchfield.value,left(FilterStr(replace(rsObj("Content"),"[NextPage]",""),"html"),infolen))
								end if
							case "pic"
								if not IsNul(rsObj("Pic")) then 
									if instr(rsObj("Pic"),"http://")>0 then 
										nloopstr = replace(nloopstr,matchfield.value,rsObj("Pic"))
									else
										nloopstr = replace(nloopstr,matchfield.value,Replace(rsObj("Pic"),"{$download_dir}", InstallDir&UploadSetting(1)))
									end if
								else
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & "Images/no_pic.png")
								end if
							case fieldName
								SqlFieldSet = "SELECT * FROM [FieldSet] WHERE Field='"& fieldName &"' AND ChannelID="& ChannelID &" AND Recycle<>1 ORDER BY OrderNum ASC"
								Call Exec(RsFieldSet,SqlFieldSet,2)
								If RsFieldSet.BOF And RsFieldSet.EOF Then
									RsFieldSet.Close
									Set RsFieldSet = Nothing
									nloopstr = replace(nloopstr,matchfield.value,"")
								Else
									Pv_FieldType = RsFieldSet("FieldType")
									RsFieldSet.Close
									Set RsFieldSet = Nothing
									if not IsNul(Pv_Field) then
										namelen = ParseArr(fieldArr)("len")
										Pv_Fieldtitle=rsObj(fieldName)
									end if
									if not IsNul(Pv_Fieldtitle) then
										If Pv_FieldType="checkbox" Then
											nloopstr = replace(nloopstr,matchfield.value,left(Pv_Fieldtitle,len(Pv_Fieldtitle)-1))
										Else
											if not IsNul(namelen) then
												namelen=cint(namelen)
												if len(rsObj(fieldName))>namelen then Pv_Fieldtitle=left(rsObj(fieldName),namelen)&"..."
											end if
											nloopstr = replace(nloopstr,matchfield.value,Pv_Fieldtitle)
										End If
									else
										nloopstr = replace(nloopstr,matchfield.value,"")
									end if
								End If
						end select
					elseif ldataname="Down" then
						select case fieldName
							case "i"
								nloopstr = replace(nloopstr,matchfield.value,i+1)
							case "link"
								'跳转链接
								if rsObj(9)<>"" then
									nloopstr = replace(nloopstr,matchfield.value,rsObj(9))
								else
									If ChannelIsCreateHtml = True Then
										nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/" & rsObj("HtmlFileDir") & ShowDatePath(rsObj("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(rsObj("HtmlFileDate"), rsObj("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, ""))
									Else
										nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/View.asp?id=" & rsObj("ID"))
									End If
								end if
							case "title"
								namelen = ParseArr(fieldArr)("len")
								title=rsObj(5)
								if not IsNul(namelen) then
									namelen=cint(namelen)
									if len(rsObj(5))>namelen then title=left(rsObj(5),namelen)&"..."
								end if
								nloopstr = replace(nloopstr,matchfield.value,title)
							case "content"
								contentlen = ParseArr(fieldArr)("len")
								pagecontent=rsObj("Content")
								if not IsNul(contentlen) then
									contentlen=cint(contentlen)
									if len(pagecontent)>contentlen then pagecontent=left(pagecontent,contentlen)&"..."
								end if
								nloopstr = replace(nloopstr,matchfield.value,pagecontent)
							case "titlecolor"
								if rsObj(21)<>"" then
									nloopstr = replace(nloopstr,matchfield.value,rsObj(21))
								else
									nloopstr = replace(nloopstr,matchfield.value,"")
								end if
							case "classname"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("ClassName"))
							case "classlink"
								If ChannelIsCreateHtml = True Then
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/" & rsObj("HtmlFileDir") & "Index" & ChannelHtmlExtName)
								Else
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/List.asp?ClassID=" & rsObj(31))
								End If
							case "date"
								timestyle = ParseArr(fieldArr)("style") : if IsNul(timestyle) then timestyle = "m-d"
								select case timestyle
									case "yy-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),1))
									case "y-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),2))
									case "m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),3))
									case "yy/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),9))
									case "y/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),10))
									case "m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),11))
								end select
							case "hits"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("Hits"))
							case "dayhits"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("DayHits"))
							case "weekhits"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("WeekHits"))
							case "monthhits"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("MonthHits"))
							case "downhits"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("DownHits"))
							case "softversion"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("SoftVersion"))
							case "softsize"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("SoftSize"))
							case "softsizem"
								nloopstr = replace(nloopstr,matchfield.value,Round(rsObj("SoftSize") / 1024, 2))
							case "copyrighttype"
								nloopstr = replace(nloopstr,matchfield.value,WK_HTMLEncode(rsObj("CopyrightType")))
							case "operatingsystem"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("OperatingSystem"))
							case "softtype"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("SoftType"))
							case "softlanguage"
								nloopstr = replace(nloopstr,matchfield.value,WK_HTMLEncode(rsObj("SoftLanguage")))
							case "demourl"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("DemoUrl"))
							case "regurl"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("RegUrl"))
							case "decompresspassword"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("DecompressPassword"))
							case "author"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("Author"))
							case "copyfrom"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("CopyFrom"))
							case "ispic" '是否图片
								nloopstr = replace(nloopstr,matchfield.value,rsObj("IsPic"))
							case "desc"
								if not IsNul(rsObj("Intro")) then
									infolen = ParseArr(fieldArr)("len") : if IsNul(infolen) then infolen = 200 else infolen=cint(infolen)
									nloopstr = replace(nloopstr,matchfield.value,left(FilterStr(replace(rsObj("Intro"),"[NextPage]",""),"html"),infolen))
								else
									infolen = ParseArr(fieldArr)("len") : if IsNul(infolen) then infolen = 200 else infolen=cint(infolen)
									nloopstr = replace(nloopstr,matchfield.value,left(FilterStr(replace(rsObj("Content"),"[NextPage]",""),"html"),infolen))
								end if
							case "pic"
								if not IsNul(rsObj("Pic")) then 
									if instr(rsObj("Pic"),"http://")>0 then 
										nloopstr = replace(nloopstr,matchfield.value,rsObj("Pic"))
									else
										nloopstr = replace(nloopstr,matchfield.value,Replace(rsObj("Pic"),"{$download_dir}", InstallDir&UploadSetting(1)))
									end if
								else
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & "Images/no_pic.png")
								end if
							case fieldName
								SqlFieldSet = "SELECT * FROM [FieldSet] WHERE Field='"& fieldName &"' AND ChannelID="& ChannelID &" AND Recycle<>1 ORDER BY OrderNum ASC"
								Call Exec(RsFieldSet,SqlFieldSet,2)
								If RsFieldSet.BOF And RsFieldSet.EOF Then
									RsFieldSet.Close
									Set RsFieldSet = Nothing
									nloopstr = replace(nloopstr,matchfield.value,"")
								Else
									Pv_FieldType = RsFieldSet("FieldType")
									RsFieldSet.Close
									Set RsFieldSet = Nothing
									if not IsNul(Pv_Field) then
										namelen = ParseArr(fieldArr)("len")
										Pv_Fieldtitle=rsObj(fieldName)
									end if
									if not IsNul(Pv_Fieldtitle) then
										If Pv_FieldType="checkbox" Then
											nloopstr = replace(nloopstr,matchfield.value,left(Pv_Fieldtitle,len(Pv_Fieldtitle)-1))
										Else
											if not IsNul(namelen) then
												namelen=cint(namelen)
												if len(rsObj(fieldName))>namelen then Pv_Fieldtitle=left(rsObj(fieldName),namelen)&"..."
											end if
											nloopstr = replace(nloopstr,matchfield.value,Pv_Fieldtitle)
										End If
									else
										nloopstr = replace(nloopstr,matchfield.value,"")
									end if
								End If
						end select
					elseif ldataname="Shop" then
						select case fieldName
							case "i"
								nloopstr = replace(nloopstr,matchfield.value,i+1)
							case "link"
								'跳转链接
								if rsObj(9)<>"" then
									nloopstr = replace(nloopstr,matchfield.value,rsObj(9))
								else
									If ChannelIsCreateHtml = True Then
										nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/" & rsObj("HtmlFileDir") & ShowDatePath(rsObj("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(rsObj("HtmlFileDate"), rsObj("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, ""))
									Else
										nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/View.asp?id=" & rsObj("ID"))
									End If
								end if
							case "title"
								namelen = ParseArr(fieldArr)("len")
								title=rsObj(5)
								if not IsNul(namelen) then
									namelen=cint(namelen)
									if len(rsObj(5))>namelen then title=left(rsObj(5),namelen)&"..."
								end if
								nloopstr = replace(nloopstr,matchfield.value,title)
							case "content"
								contentlen = ParseArr(fieldArr)("len")
								pagecontent=rsObj("Content")
								if not IsNul(contentlen) then
									contentlen=cint(contentlen)
									if len(pagecontent)>contentlen then pagecontent=left(pagecontent,contentlen)&"..."
								end if
								nloopstr = replace(nloopstr,matchfield.value,pagecontent)
							case "titlecolor"
								if rsObj(21)<>"" then
									nloopstr = replace(nloopstr,matchfield.value,rsObj(21))
								else
									nloopstr = replace(nloopstr,matchfield.value,"")
								end if
							case "classname"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("ClassName"))
							case "classlink"
								If ChannelIsCreateHtml = True Then
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/" & rsObj("HtmlFileDir") & "Index" & ChannelHtmlExtName)
								Else
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/List.asp?ClassID=" & rsObj(31))
								End If
							case "date"
								timestyle = ParseArr(fieldArr)("style") : if IsNul(timestyle) then timestyle = "m-d"
								select case timestyle
									case "yy-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),1))
									case "y-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),2))
									case "m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),3))
									case "yy/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),9))
									case "y/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),10))
									case "m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),11))
								end select
							case "hits"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("Hits"))
							case "author"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("Author"))
							case "copyfrom"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("CopyFrom"))
							case "ispic" '是否图片
								nloopstr = replace(nloopstr,matchfield.value,rsObj("IsPic"))
							case "desc"
								if not IsNul(rsObj("Intro")) then
									infolen = ParseArr(fieldArr)("len") : if IsNul(infolen) then infolen = 200 else infolen=cint(infolen)
									nloopstr = replace(nloopstr,matchfield.value,left(FilterStr(replace(rsObj("Intro"),"[NextPage]",""),"html"),infolen))
								else
									infolen = ParseArr(fieldArr)("len") : if IsNul(infolen) then infolen = 200 else infolen=cint(infolen)
									nloopstr = replace(nloopstr,matchfield.value,left(FilterStr(replace(rsObj("Content"),"[NextPage]",""),"html"),infolen))
								end if
							case "pic"
								if not IsNul(rsObj("Pic")) then
									if instr(rsObj("Pic"),"http://")>0 then
										nloopstr = replace(nloopstr,matchfield.value,rsObj("Pic"))
									else
										nloopstr = replace(nloopstr,matchfield.value,Replace(rsObj("Pic"),"{$download_dir}", InstallDir&UploadSetting(1)))
									end if
								else
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & "Images/no_pic.png")
								end if
							case fieldName
								SqlFieldSet = "SELECT * FROM [FieldSet] WHERE Field='"& fieldName &"' AND ChannelID="& ChannelID &" AND Recycle<>1 ORDER BY OrderNum ASC"
								Call Exec(RsFieldSet,SqlFieldSet,2)
								If RsFieldSet.BOF And RsFieldSet.EOF Then
									RsFieldSet.Close
									Set RsFieldSet = Nothing
									nloopstr = replace(nloopstr,matchfield.value,"")
								Else
									Pv_FieldType = RsFieldSet("FieldType")
									RsFieldSet.Close
									Set RsFieldSet = Nothing
									if not IsNul(Pv_Field) then
										namelen = ParseArr(fieldArr)("len")
										Pv_Fieldtitle=rsObj(fieldName)
									end if
									if not IsNul(Pv_Fieldtitle) then
										If Pv_FieldType="checkbox" Then
											nloopstr = replace(nloopstr,matchfield.value,left(Pv_Fieldtitle,len(Pv_Fieldtitle)-1))
										Else
											if not IsNul(namelen) then
												namelen=cint(namelen)
												if len(rsObj(fieldName))>namelen then Pv_Fieldtitle=left(rsObj(fieldName),namelen)&"..."
											end if
											nloopstr = replace(nloopstr,matchfield.value,Pv_Fieldtitle)
										End If
									else
										nloopstr = replace(nloopstr,matchfield.value,"")
									end if
								End If
						end select
					elseif ldataname="GuestBook" then
						select case fieldName
							case "i"
								nloopstr = replace(nloopstr,matchfield.value,i+1)
							case "link"
								'if rsObj(5)=1 then nloopstr = replace(nloopstr,matchfield.value,rsObj(9)) : else nloopstr = replace(nloopstr,matchfield.value,getContentLink(rsObj(0),rsObj(0),showType))
							case "title"
								namelen = ParseArr(fieldArr)("len")
								title=filterDirty(rsObj(1))
								if not IsNul(namelen) then
									namelen=cint(namelen)
									if len(title)>namelen then title=left(title,namelen)&"..."
								end if
								nloopstr = replace(nloopstr,matchfield.value,title)
							case "name"
								nloopstr = replace(nloopstr,matchfield.value,repNull(rsObj(2)))
							case "status"
								nloopstr = replace(nloopstr,matchfield.value,rsObj(8))
							case "winfo"
								nloopstr = replace(nloopstr,matchfield.value,filterDirty(repNull(rsObj(4))))
							case "rinfo"
								nloopstr = replace(nloopstr,matchfield.value,repNull(rsObj(5)))
							case "wdate"
								timestyle = ParseArr(fieldArr)("style") : if IsNul(timestyle) then timestyle = "m-d"
								select case timestyle
									case "yy-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj(6),1))
									case "y-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj(6),2))
									case "m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj(6),3))
									case "yy/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj(6),9))
									case "y/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj(6),10))
									case "m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj(6),11))
								end select
							case "rdate"
								timestyle = ParseArr(fieldArr)("style") : if IsNul(timestyle) then timestyle = "m-d"
								select case timestyle
									case "yy-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj(7),1))
									case "y-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj(7),2))
									case "m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj(7),3))
									case "yy/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj(7),9))
									case "y/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj(7),10))
									case "m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj(7),11))
								end select
						end select
					else
						select case fieldName
							case "i"
								nloopstr = replace(nloopstr,matchfield.value,i+1)
							case "link"
								'跳转链接
								if rsObj(9)<>"" then
									nloopstr = replace(nloopstr,matchfield.value,rsObj(9))
								else
									If ChannelIsCreateHtml = True Then
										nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/" & rsObj("HtmlFileDir") & ShowDatePath(rsObj("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(rsObj("HtmlFileDate"), rsObj("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, ""))
									Else
										nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/View.asp?id=" & rsObj("ID"))
									End If
								end if
							case "title"
								namelen = ParseArr(fieldArr)("len")
								title=rsObj(5)
								if not IsNul(namelen) then
									namelen=cint(namelen)
									if len(rsObj(5))>namelen then title=left(rsObj(5),namelen)&"..."
								end if
								nloopstr = replace(nloopstr,matchfield.value,title)
							case "content"
								contentlen = ParseArr(fieldArr)("len")
								pagecontent=rsObj("Content")
								if not IsNul(contentlen) then
									contentlen=cint(contentlen)
									if len(pagecontent)>contentlen then pagecontent=left(pagecontent,contentlen)&"..."
								end if
								nloopstr = replace(nloopstr,matchfield.value,pagecontent)
							case "titlecolor"
								if rsObj(21)<>"" then
									nloopstr = replace(nloopstr,matchfield.value,rsObj(21))
								else
									nloopstr = replace(nloopstr,matchfield.value,"")
								end if
							case "classname"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("ClassName"))
							case "classlink"
								If ChannelIsCreateHtml = True Then
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/" & rsObj("HtmlFileDir") & "Index" & ChannelHtmlExtName)
								Else
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/List.asp?ClassID=" & rsObj(31))
								End If
							case "date"
								timestyle = ParseArr(fieldArr)("style") : if IsNul(timestyle) then timestyle = "m-d"
								select case timestyle
									case "yy-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),1))
									case "y-m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),2))
									case "m-d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),3))
									case "yy/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),9))
									case "y/m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),10))
									case "m/d"
										nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),11))
								end select
							case "hits"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("Hits"))
							case "author"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("Author"))
							case "copyfrom"
								nloopstr = replace(nloopstr,matchfield.value,rsObj("CopyFrom"))
							case "ispic" '是否图片
								nloopstr = replace(nloopstr,matchfield.value,rsObj("IsPic"))
							case "desc"
								if not IsNul(rsObj("Intro")) then
									infolen = ParseArr(fieldArr)("len") : if IsNul(infolen) then infolen = 200 else infolen=cint(infolen)
									nloopstr = replace(nloopstr,matchfield.value,left(FilterStr(replace(rsObj("Intro"),"[NextPage]",""),"html"),infolen))
								else
									infolen = ParseArr(fieldArr)("len") : if IsNul(infolen) then infolen = 200 else infolen=cint(infolen)
									nloopstr = replace(nloopstr,matchfield.value,left(FilterStr(replace(rsObj("Content"),"[NextPage]",""),"html"),infolen))
								end if
							case "pic"
								if not IsNul(rsObj("Pic")) then 
									if instr(rsObj("Pic"),"http://")>0 then 
										nloopstr = replace(nloopstr,matchfield.value,rsObj("Pic"))
									else
										nloopstr = replace(nloopstr,matchfield.value,Replace(rsObj("Pic"),"{$download_dir}", InstallDir&UploadSetting(1)))
									end if
								else
									nloopstr = replace(nloopstr,matchfield.value,InstallDir & "Images/no_pic.png")
								end if
							case fieldName
								SqlFieldSet = "SELECT * FROM [FieldSet] WHERE Field='"& fieldName &"' AND ChannelID="& ChannelID &" AND Recycle<>1 ORDER BY OrderNum ASC"
								Call Exec(RsFieldSet,SqlFieldSet,2)
								If RsFieldSet.BOF And RsFieldSet.EOF Then
									RsFieldSet.Close
									Set RsFieldSet = Nothing
									nloopstr = replace(nloopstr,matchfield.value,"")
								Else
									Pv_FieldType = RsFieldSet("FieldType")
									RsFieldSet.Close
									Set RsFieldSet = Nothing
									if not IsNul(Pv_Field) then
										namelen = ParseArr(fieldArr)("len")
										Pv_Fieldtitle=rsObj(fieldName)
									end if
									if not IsNul(Pv_Fieldtitle) then
										If Pv_FieldType="checkbox" Then
											nloopstr = replace(nloopstr,matchfield.value,left(Pv_Fieldtitle,len(Pv_Fieldtitle)-1))
										Else
											if not IsNul(namelen) then
												namelen=cint(namelen)
												if len(rsObj(fieldName))>namelen then Pv_Fieldtitle=left(rsObj(fieldName),namelen)&"..."
											end if
											nloopstr = replace(nloopstr,matchfield.value,Pv_Fieldtitle)
										End If
									else
										nloopstr = replace(nloopstr,matchfield.value,"")
									end if
								End If
							end select
						end if
					next
					loopstrTotal = loopstrTotal & nloopstr
					rsObj.movenext
					if rsObj.eof then exit for
				next
			end if
			
			HtmlContent = replace(HtmlContent,match.value,loopstrTotal)
			regEx.Pattern = labelRulePagelist
			set matchesPagelist = regEx.Execute(HtmlContent)
			for each matchPagelist in matchesPagelist
				if rsObj.pagecount=0 then
					HtmlContent = replace(HtmlContent,matchPagelist.value,"")
				else
					lenPagelist = parseArr(matchPagelist.SubMatches(0))("len")
					if IsNul(lenPagelist) then lenPagelist = 10 else lenPagelist = cint(lenPagelist)
					
					If ChannelIsCreateHtml = True Then
						If IsNul(keys) Then
							strPagelist = pageNumberLinkInfo_Html(currentPage,lenPagelist,rsObj.recordCount,rsObj.pagecount,InstallDir & ChannelDir & "/" & HtmlFileDir,ChannelHtmlExtName,ChannelUnit & ChannelTit)
						Else
							strPagelist = pageNumberLinkInfo(currentPage,lenPagelist,rsObj.recordCount,rsObj.pagecount,strFileName,ChannelUnit & ChannelTit)
						End If
					Else
						strPagelist = pageNumberLinkInfo(currentPage,lenPagelist,rsObj.recordCount,rsObj.pagecount,strFileName,ChannelUnit & ChannelTit)
					End If
					
					HtmlContent = replace(HtmlContent,matchPagelist.value,strPagelist)
				end if
			next			
			set matchesPagelist = nothing
			set matchesfield = nothing
			StrDictionary.removeAll
		next
		set matches = nothing
		set StrDictionary=nothing
	End Function
	
	'替换循环Sql标签
	Public Function EnSql()
		dim labelRule,labelRuleField,StrDictionary,matches,match,RsFieldSet,SqlFieldSet,Pv_Field,Pv_Fieldtitle,Pv_FieldType
		labelRule = "{wangkaicms:sql([\s\S]*?)}([\s\S]*?){/wangkaicms}"
		labelRuleField = "\[wangkaicms:([\s\S]+?)\]"
		regEx.Pattern = labelRule
		set StrDictionary=Server.CreateObject("SCRIPTING.DICTIONARY")
		set matches = regEx.Execute(HtmlContent)
		for each match in matches
		    labelStr = match.SubMatches(0)
			loopStr = match.SubMatches(1)
			regEx.Pattern="([a-zA-Z0-9_]*)=[""](.+?)[""]"
			set matchs1=regEx.Execute(labelStr)
			if matchs1.count>0 then
				for each match1 In matchs1
					Execute(""&match1.submatches(0)&"="""&match1.submatches(1)&"""")
				next
			end if
			
			if IsNul(channel) then channel=1
			
			Call GetChannel(channel)
			
			dim rsObj
			Call Exe_Conn(rsObj,cmd,1)
			regEx.Pattern = labelRuleField
			set matchesfield = regEx.Execute(loopStr)
			loopstrTotal = ""
			dim nloopstr,matchfield,fieldNameArr,m,fieldName,fieldArr,infolen,namelen,timestyle
			i=0
			Do While Not rsObj.EOF
			    nloopstr=loopStr
			    for each matchfield in matchesfield
					fieldNameArr = RegExpReplace(matchfield.SubMatches(0),"[\s]+",chr(32))
					fieldNameArr = trim(fieldNameArr)
					m = instr(fieldNameArr,chr(32))
					if  m > 0 then
						fieldName = left(fieldNameArr,m - 1)
						fieldArr = right(fieldNameArr,len(fieldNameArr) - m)
					else
						fieldName = fieldNameArr
						fieldArr = ""
					end if
					select case fieldName
					case "i"
						nloopstr = replace(nloopstr,matchfield.value,i+1)
					case "link"
						'跳转链接
						If CLng(rsObj("ClassID")) <> 0 Then
							Sql = "Select * From [Class] Where ChannelID=" & rsObj("ChannelID") & " And ClassID=" & rsObj("ClassID")
							Call Exec(Rs,Sql,2)
							If Rs.BOF And Rs.EOF Then
								HtmlFileDir = rsObj("HtmlFileDir")
							Else
								HtmlFileDir = Rs("HtmlFileDir")
							End If
							Set Rs = Nothing
						Else
							HtmlFileDir = rsObj("HtmlFileDir")
						End If
						If HtmlFileDir="" Then HtmlFileDir = rsObj("HtmlFileDir")
						if rsObj("LinkUrl")<>"" then
							nloopstr = replace(nloopstr,matchfield.value,rsObj("LinkUrl"))
						else
							If ChannelIsCreateHtml = True Then
								nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/" & HtmlFileDir & ShowDatePath(rsObj("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(rsObj("HtmlFileDate"), rsObj("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, ""))
							Else
								nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/View.asp?id=" & rsObj("ID"))
							End If
						end if
					case "titlecolor"
						if rsObj("Tcolor")<>"" then
							nloopstr = replace(nloopstr,matchfield.value,rsObj("Tcolor"))
						else
							nloopstr = replace(nloopstr,matchfield.value,"")
						end if
					case "classname"
						If CLng(rsObj("ClassID")) <> 0 Then
							Sql = "Select * From [Class] Where ChannelID=" & rsObj("ChannelID") & " And ClassID=" & rsObj("ClassID")
							Call Exec(Rs,Sql,2)
							If Rs.BOF And Rs.EOF Then
								classname = rsObj("ClassName")
							Else
								classname = Rs("ClassName")
							End If
							Set Rs = Nothing
						Else
							classname = rsObj("ClassName")
						End If
						If classname="" Then classname = rsObj("ClassName")
						namelen = ParseArr(fieldArr)("len")
						if not IsNul(namelen) then
							namelen=cint(namelen)
							if len(classname)>namelen then classname=left(classname,namelen)&"..."
						end if
						nloopstr = replace(nloopstr,matchfield.value,classname)
					case "classlink"
						If CLng(rsObj("ClassID")) <> 0 Then
							Sql = "Select * From [Class] Where ChannelID=" & rsObj("ChannelID") & " And ClassID=" & rsObj("ClassID")
							Call Exec(Rs,Sql,2)
							If Rs.BOF And Rs.EOF Then
								HtmlFileDir = rsObj("HtmlFileDir")
							Else
								HtmlFileDir = Rs("HtmlFileDir")
							End If
							Set Rs = Nothing
						Else
							HtmlFileDir = rsObj("HtmlFileDir")
						End If
						If HtmlFileDir="" Then HtmlFileDir = rsObj("HtmlFileDir")
						If ChannelIsCreateHtml = True Then
							nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/" & HtmlFileDir & "Index" & ChannelHtmlExtName)
						Else
							nloopstr = replace(nloopstr,matchfield.value,InstallDir & ChannelDir & "/List.asp?ClassID=" & rsObj("ClassID"))
						End If
					case "date"
						timestyle = ParseArr(fieldArr)("style") : if IsNul(timestyle) then timestyle = "m-d"
						select case timestyle
							case "yy-m-d"
								nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),1))
							case "y-m-d"
								nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),2))
							case "m-d"
								nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),3))
							case "yy/m/d"
								nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),9))
							case "y/m/d"
								nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),10))
							case "m/d"
								nloopstr = replace(nloopstr,matchfield.value,FormatDate(rsObj("Tim"),11))
						end select
					case "hits"
						nloopstr = replace(nloopstr,matchfield.value,rsObj("Hits"))
					case "author"
						nloopstr = replace(nloopstr,matchfield.value,rsObj("Author"))
					case "copyfrom"
						nloopstr = replace(nloopstr,matchfield.value,rsObj("CopyFrom"))
					case "ispic" '是否图片
						nloopstr = replace(nloopstr,matchfield.value,rsObj("IsPic"))
					case "desc"
						if not IsNul(rsObj("Intro")) then
							infolen = ParseArr(fieldArr)("len") : if IsNul(infolen) then infolen = 200 else infolen=cint(infolen)
							nloopstr = replace(nloopstr,matchfield.value,left(FilterStr(replace(rsObj("Intro"),"[NextPage]",""),"html"),infolen))
						else
							infolen = ParseArr(fieldArr)("len") : if IsNul(infolen) then infolen = 200 else infolen=cint(infolen)
							nloopstr = replace(nloopstr,matchfield.value,left(FilterStr(replace(rsObj("Content"),"[NextPage]",""),"html"),infolen))
						end if
					case "pic"
						if not IsNul(rsObj("Pic")) then 
							if instr(rsObj("Pic"),"http://")>0 then 
								nloopstr = replace(nloopstr,matchfield.value,rsObj("Pic"))
							else
								nloopstr = replace(nloopstr,matchfield.value,Replace(rsObj("Pic"),"{$download_dir}", InstallDir&UploadSetting(1)))
							end if
						else
							nloopstr = replace(nloopstr,matchfield.value,InstallDir & "Images/no_pic.png")
						end if
					case fieldName
						SqlFieldSet = "SELECT * FROM [FieldSet] WHERE Field='"& fieldName &"' AND ChannelID='"& rsObj("ChannelID") &"' AND Recycle<>1 ORDER BY OrderNum ASC"
						Call Exec(RsFieldSet,SqlFieldSet,2)
						If RsFieldSet.BOF And RsFieldSet.EOF Then
							RsFieldSet.Close
							Set RsFieldSet = Nothing
							nloopstr = replace(nloopstr,matchfield.value,"")
						Else
							Pv_FieldType = RsFieldSet("FieldType")
							RsFieldSet.Close
							Set RsFieldSet = Nothing
							namelen = ParseArr(fieldArr)("len")
							title=rsObj(fieldName)
							if not IsNul(title) then
								If Pv_FieldType="checkbox" Then
									nloopstr = replace(nloopstr,matchfield.value,left(title,len(title)-1))
								Else
								if not IsNul(namelen) then
									namelen=cint(namelen)
									if len(rsObj(fieldName))>namelen then title=left(rsObj(fieldName),namelen)&"..."
								end if
									nloopstr = replace(nloopstr,matchfield.value,title)
								End If
							else
								nloopstr = replace(nloopstr,matchfield.value,"")
							end if
						End If
					end select
				next
				loopstrTotal = loopstrTotal & nloopstr
			rsObj.movenext
			i=i+1
			Loop
			set matchesfield = nothing
			HtmlContent = replace(HtmlContent,match.value,loopstrTotal)
			StrDictionary.removeAll
		next
		set matches = nothing
		set StrDictionary=nothing
	End Function
	
	Function makeContentImages(sContent)
		'{wangkaicms:cimages channel=1 count=5 contentid=1}
		'[cimages:src]
		'[cimages:title]
		'{/wangkaicms:cimages}

		'if instr(sConetnt,"{wangkaicms:cimages") then
			dim rs,sql,img,imgs
			dim m_labelRule,m_labelRuleField
			dim match,matches
			dim m_contentid
			dim m_maxcount,iCount
			dim soutput
			dim m_type
			
			soutput = ""
			m_contentid = empty
			iCount = 0	
			
			m_labelRule="{wangkaicms:cimages([\s\S]*?)}([\s\S]*?){/wangkaicms:cimages}"
			
			regEx.Pattern=m_labelRule
			set matches=regEx.Execute(sContent)
			
			for each match in matches
				'echo "ci"
				m_channel = parseArr(match.SubMatches(0))("channel")
				m_contentid = parseArr(match.SubMatches(0))("contentid")
				m_maxcount = parseArr(match.SubMatches(0))("count")
				
				If m_channel > 0 Then
					Call GetChannel(m_channel)
				End If
				
				if IsNul(ChannelDataName) then ChannelDataName="Article"
				
				if IsNul(m_maxcount) or not isnumeric(m_maxcount) then m_maxcount = 9999
				
				sql="select ZuTu from {prefix}"&ChannelDataName&" where ID="
				
				if not IsNul(m_contentid) then
					if not isnumeric(m_contentid) then m_contentid=-1
					sql = sql&m_contentid
					Call Exec(rs,sql,2)
					if not rs.eof then
						img=rs(0)
					end if
					rs.close
					set rs = nothing
					
					'If Instr(imgs,",") > 0) Then imgs = split(img,",")
					imgs = split(img,",")
					
					for each img in imgs
						img = split(img,"@@@")
						if iCount < cint(m_maxcount) then
							soutput = soutput & match.SubMatches(1)
							'soutput = replace(soutput,"[wangkaicms:cimagesitem]","")
							'soutput = replace(soutput,"[/wangkaicms:cimagesitem]","")
							soutput =  replace(soutput,"[cimages:src]",img(0))
							soutput =  replace(soutput,"[cimages:title]",img(1))
							soutput = replace(soutput,"[cimages:i]",iCount+1)
							'echo img & "<br>"
						end if
						iCount = iCount + 1
					next
				end if
				'die soutput
				sContent=ReplaceStr(sContent,match.value,soutput)
				'die sConetnt
			next
			
			if instr(sContent,"{wangkaicms:cimages") > 0 then
				'die "停止"
				makeContentImages sContent
			end if
		'end if
		makeContentImages = sContent
	End Function
	
	'解析辅助模板
	Public Function parseAuxiliaryTemplate()
		Dim labelRuleRuxiliaryTemplate,matchesRuxiliary,matchRuxiliary,srcTemplate
		labelRuleRuxiliaryTemplate = "\{wangkaicms:template([\s\S]*?)\}"
		regEx.Pattern = labelRuleRuxiliaryTemplate
		set matchesRuxiliary = regEx.Execute(HtmlContent)
		for each matchRuxiliary in matchesRuxiliary
			srcTemplate = parseArr(matchRuxiliary.SubMatches(0))("src")
			HtmlContent=replace(HtmlContent,"{wangkaicms:template src="&srcTemplate&"}",LoadFile(InstallDir&"Templates/"&srcTemplate))
		next
		set matchesRuxiliary = nothing
	End Function
	
	'解析if
	Public Function ParseIf()
		if not isExistStr(HtmlContent,"{if:") then Exit Function
		dim matchIf,matchesIf,strIf,strThen,strThen1,strElse1,labelRule2,labelRule3
		dim ifFlag,elseIfArray,elseIfSubArray,elseIfArrayLen,resultStr,elseIfLen,strElseIf,strElseIfThen,elseIfFlag
		labelRule="{if:([\s\S]+?)}([\s\S]*?){end\s+if}":labelRule2="{elseif":labelRule3="{else}":elseIfFlag=false
		regEx.Pattern=labelRule
		set matchesIf=regEx.Execute(HtmlContent)
		for each matchIf in matchesIf 
			strIf=matchIf.SubMatches(0):strThen=matchIf.SubMatches(1)
			if instr(strThen,labelRule2)>0 then
				elseIfArray=split(strThen,labelRule2):elseIfArrayLen=ubound(elseIfArray):elseIfSubArray=split(elseIfArray(elseIfArrayLen),labelRule3)
				resultStr=elseIfSubArray(1)
				Execute("if "&strIf&" then resultStr=elseIfArray(0)")
				for elseIfLen=1 to elseIfArrayLen-1
					strElseIf=getSubStrByFromAndEnd(elseIfArray(elseIfLen),":","}","")
					strElseIfThen=getSubStrByFromAndEnd(elseIfArray(elseIfLen),"}","","start")
					Execute("if "&strElseIf&" then resultStr=strElseIfThen")
					Execute("if "&strElseIf&" then elseIfFlag=true else elseIfFlag=false")
					if elseIfFlag then exit for
				next
				Execute("if "&getSubStrByFromAndEnd(elseIfSubArray(0),":","}","")&" then resultStr=getSubStrByFromAndEnd(elseIfSubArray(0),""}"","""",""start""):elseIfFlag=true")
				HtmlContent=replace(HtmlContent,matchIf.value,resultStr)
			else 
				if instr(strThen,"{else}")>0 then 
					strThen1=split(strThen,labelRule3)(0)
					strElse1=split(strThen,labelRule3)(1)
					Execute("if "&strIf&" then ifFlag=true else ifFlag=false")
					if ifFlag then HtmlContent=replace(HtmlContent,matchIf.value,strThen1) else HtmlContent=replace(HtmlContent,matchIf.value,strElse1)
				else	
					Execute("if "&strIf&" then ifFlag=true else ifFlag=false")
					if ifFlag then HtmlContent=replace(HtmlContent,matchIf.value,strThen) else HtmlContent=replace(HtmlContent,matchIf.value,"")
				end if
			end if
			elseIfFlag=false
		next
		set matchesIf=nothing
	End Function
End Class
%>